in reply to How to sort by the key value of an Array of Hash structure?

Stolen from this Q&A node, you can do a Schwartzian Transformation by doing:

my @sorted = map{ $_->[1] } sort { $b->[0] <=> $a->[0] } map{ [ $_->{size}, $_ ] } @{$aoh}; print Dumper \@sorted;

Replies are listed 'Best First'.
Re^2: How to sort by the key value of an Array of Hash structure?
by kyle (Abbot) on Jul 30, 2008 at 17:56 UTC

    Unless the "hashes" are actually tied or overloaded objects with really slow access times, I expect moritz's much simpler sort { $a->{size} <=> $b->{size} } will also be faster (but I'm ready to be corrected).