in reply to Do the Schwartzian boogy!
Your case is much simpler (assuming you want to create copies):
Note that the map gets array references as $_, not pairs in @_.#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @AoA = ( [ "n1", "34" ], [ "n3", "14" ], [ "n2", "1" ], [ "n4", "5" ], ); my @sorted = map { [ @$_ ] } sort { $a->[1] <=> $b->[1] } @AoA; print Dumper(\@sorted); __END__ $VAR1 = [ [ 'n2', 1 ], [ 'n4', 5 ], [ 'n3', 14 ], [ 'n1', 34 ] ];
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.
|
|---|