in reply to Classic Sort Algorithm
This is a FAQ: How do I sort an array by (anything)?. (See also perldoc perlfaq4) You want the
@sorted = sort { field1($a) <=> field1($b) || field2($a) cmp field2($b) || field3($a) cmp field3($b) } @data;
'paradigm' for multi-key sorting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Classic Sort Algorithm
by BoulderBuff64 (Novice) on Jun 20, 2011 at 23:05 UTC | |
by 7stud (Deacon) on Jun 21, 2011 at 00:12 UTC |