in reply to Sorting an AoA?

@array = sort { $a->[0] cmp $b->[0] } @array; # ascending #@array = sort { $b->[0] cmp $a->[0] } @array; # descending

Update:

for my $i ( 0 .. $#array ) isn't a very Perlish way of iterating over an array.

Both

for my $elem ( @array ) { print "$elem->[0]\n"; }

and

print "$_->[0]\n" for @array;

are considered more idiomatic.