hash sort on value
- From: chrisstinemetz@xxxxxxxxx (Chris Stinemetz)
- Date: Mon, 2 Jul 2012 11:42:44 -0500
I have a 3 deminsional hash that I would like to sort on the value in
descending order. I can't quite seem to figure it out
The portion of the program I can't get figured out:
## body
foreach my $frameNo ( keys %RNC ) {
foreach my $ec ( keys %{$RNC{$frameNo}} ) {
my $ec_count = $RNC{$frameNo}{$ec};
printf $out("%-4s %-25s %-10s\n",$frameNo,$ec,$ec_count);
}
}
This is what the hash looks like:
$VAR1 = {
'22' => {
'44021' => '1',
'80002' => '25',
'51002' => '213',
'51009' => '194',
'26005' => '5',
'44003' => '194',
'80000' => '50',
'10011' => '156'
},
'23' => {
'80002' => '11',
'10013' => '10',
'10014' => '47',
'27006' => '3',
'42065' => '23',
'90001' => '17',
'22008' => '59',
'44003' => '209',
'80000' => '54',
'10011' => '155'
},
'24' => {
'10012' => '47',
'10013' => '2',
'27001' => '3',
'44003' => '335',
'10011' => '914',
'80000' => '21'
}
};
.
- Follow-Ups:
- Re: hash sort on value
- From: Rob Dixon
- Re: hash sort on value
- From: David Precious
- Re: hash sort on value
- Prev by Date: Re: MySQL and Perl
- Next by Date: Re: hash sort on value
- Previous by thread: MySQL and Perl
- Next by thread: Re: hash sort on value
- Index(es):