This is a FAQ. See perlfaq4 or perldoc -q sort:
Found in /usr/local/lib/perl5/5.10.0/pod/perlfaq4.pod
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;
Change that to use references and you're done.
In reply to Re: Sort a 2D array based on 2 columns
by shmem
in thread Sort a 2D array based on 2 columns
by masala_curry
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |