my @array=( ["def","456","$%^"], ["abc","123","!@#"], ["ghi","789","&*("] ); #code to sort the aoa here @array = sort { $a->[0] cmp $b->[0] } @array; for my $i ( 0 .. $#array ) { print "$array[$i][0]\n"; } __END__ abc def ghi
Update: See also How to sort array by columns maintaining the rows? (for C style arrays) and How do I sort a multidimensional arrays?
In reply to Re: Sorting an AoA?
by kyle
in thread Sorting an AoA?
by dayton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |