[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Comparing two arrays



On Sun, Jul 23, 2000 at 10:03:23AM -0400, Jeff Pinyan wrote:
> On Jul 23, abigail@foad.org said:
> 
> >    map  {(split /\0/) [-1]}
> >    sort
> >    map  {join "\0" => key1, ... , keyn, value}
> 
> Depending on the size of 'n', would the first map be better off as:
> 
>   map /\0([^\0]*)$/,

Or even

    map {substr $_ => 1 + rindex $_ => "\0"}

> (especially if value happens to be an empty string, since the split would
> remove the empty trailing fields...).

That can also be solved with

    map {(split /\0/ => $_, -1) [-1]}


Abigail

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe