in reply to Sorting HOH
As ysth says your question is a bit vague. Anyway, here's an approach that you can start to work with.
You'll have to implement &pair yourself.use Hash::Flatten qw/ flatten unflatten /; sub pair { ... } # 1,2,3,4 => [1,2],[3,4] my %data; $data{1} = {'a' => 10, 'b' => 5, 'c' => 20 }; $data{2} = {'a' => 90, 'b' => 15, 'c' => 40 }; my @sorted = sort { $a->[1] <=> $b->[1] } pair(%{flatten(\%data)}); print $_->[0], "\n" for @sorted[0..2]; __END__ 1.b 1.a 2.b
ihb
See perltoc if you don't know which perldoc to read!
|
|---|