Zoop has asked for the wisdom of the Perl Monks concerning the following question:
I am not sure if its a right place to post this but its something I observed while reading through and I guess it might need correction if at all I am right.
In perlfaq,under the topic
How do I sort an array by (anything)?
Supply a comparison function to sort() (described in sort):
1. @list = sort { $a <=> $b } @list;
The default sort function is cmp, string comparison, which would sort (1, 2, 10) into (1, 10, 2) . <=> , used above, is the numerical comparison operator.
All said and done but I must admit about perl that I have not come across any other language (of course out of a handful which I boast I know) that has such an extensive documentation categorized in such a pretty way and accessible in so many ways :)
/zoop
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perlfaq4 error ? good catch: I am stupid
by shmem (Chancellor) on Sep 08, 2009 at 07:35 UTC | |
by Zoop (Acolyte) on Sep 08, 2009 at 07:52 UTC | |
by Anonymous Monk on Sep 08, 2009 at 08:16 UTC | |
by graq (Curate) on Sep 08, 2009 at 09:54 UTC | |
by Zoop (Acolyte) on Sep 08, 2009 at 12:31 UTC | |
by Zen (Deacon) on Sep 09, 2009 at 13:50 UTC | |
by graq (Curate) on Sep 18, 2009 at 12:24 UTC | |
Re: perlfaq4 error ? good catch: I am stupid
by AnomalousMonk (Archbishop) on Sep 08, 2009 at 13:48 UTC |