# Pull out a list of records my @data; foreach my $section (keys %hash) { foreach my $item (keys %{$hash{$section}}) { push @data, [$hash{$section}{$item}, $section, $item]; } } # sort it @data = sort { $b->[0] <=> $a->[0] or $a->[1] cmp $b->[1] or $a->[2] cmp $b->[2] } @data; # Print it. print "Count Section Item\n"; foreach my $record (@data) { printf("%5d %7s %7s\n", @$record); }
In reply to Re: Hash sorting
by tilly
in thread Hash sorting
by artist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |