in reply to MsExcel like Multi Column Sorting
From perlfaq4 - How do I sort an array by (anything)?:
If you need to sort on several fields, the following paradigm is useful.
@sorted = sort { field1($a) <=> field1($b) || field2($a) cmp field2($b) || field3($a) cmp field3($b) } @data;
(Also, it's "Perl", not "PERL")
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: MsExcel like Multi Column Sorting
by bart (Canon) on Dec 01, 2006 at 12:23 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |