in reply to Sorting multi-hash values
I read from a delimited file and create a hash of a hash of an array.See and that exactly is the problem :) Use an AoA and the sort will become trivial.
my @data; for $colour (sort keys %hash){ for $device (sort keys %{ $hash{$colour}}){ push @data, [ $colour, $device, $hash{$colour}{$device}[0] ] +; } } @data = reverse sort { $a->[2] <=> $b->[2] } @data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting multi-hash values
by naikonta (Curate) on Aug 22, 2007 at 18:32 UTC | |
by holli (Abbot) on Aug 22, 2007 at 18:35 UTC | |
by naikonta (Curate) on Aug 22, 2007 at 18:41 UTC | |
by moritz (Cardinal) on Aug 22, 2007 at 20:31 UTC | |
by ikegami (Patriarch) on Aug 22, 2007 at 20:27 UTC |