I have a question for the Wise Perl Monks, thanks in advance. I am using map and sort to sort by 2 columns. The trouble I am having is, it does sort the first column but it will not sort by any other column when I change the number. The list has numbers to sort. This is delimited by tab. What am I doing wrong?
my @sorted = map {$_->[0]} sort { $a->[0] <=> $b->[0] || sort { $a->[1] <=> $b->[1] } map {chomp;[$_,split(/\t/)]} <FILE>; print OUT "$_\n" for @sorted;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |