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

Re: [MacPerl] Complex sort(?)



At 2:23 PM -0400 9/3/99, Ronald J Kimball wrote:
>On Fri, Sep 03, 1999 at 10:18:51AM -0700, Brian McNett wrote:
>>
>> The combination of regex and sort needed has got me flumoxed.  Is there
>> someone out there willing to provide pointers to get me started?
>>
>
>Here are two pointers:
>
>http://www.perl.com/pub/doc/manual/html/pod/perlfaq4.html#How_do_I_so 
>rt_an_array_by_anyth
>http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html
>
>HTH!

Except, of course, that one otherwise very useful example in the 
first referenced site appears to have an extra left parenthesis:

perlfaq4.html#How_do_I_sort_an_array_by_anyth says:
...
Which could also be written this way, using a trick that's come to be 
known as the Schwartzian Transform:

       @sorted = map  { $_->[0] }
                 sort { $a->[1] cmp $b->[1] }
                 map  { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;
                                ^
                              oops!


- Bruce

_Bruce_Van_Allen___bva@cruzio.com__831_429_1688_V_
_PO_Box_839__Santa_Cruz_CA__95061__831_426_2474_W_

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org