in reply to sorting array of arrays
Your sorting code treats each element of @ar as an array when it is instead an array ref. Using warnings would have alerted you to that.
@ar = ([1,12],[8,3],[4,57],[22,5]); @sort = sort{$a->[1]<=>$b->[1]}@ar; foreach (@sort){ print "@$_\n"; }
In Section
Seekers of Perl Wisdom