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"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: sorting array of arrays
by Anonymous Monk on Jan 18, 2020 at 17:43 UTC |
In Section
Seekers of Perl Wisdom