in reply to Sorting a Hash of Hashes

McDarren's response is probably correct but, just to elaborate further...

The first thing you should note is that your sorting hashes, that is, they're being demoted to mere scalars in order to be sorted. The scalar representation of a hash is a rather useless value that shows some internal statistics about the hash. Consider this code:

my %foo =( '11' =>{ '4'=>'Four', }, '33' =>{ '1'=>'One', }, '2' =>{ '2' => 'Two', }, ); my $ref_HoH = \%foo; my @sorted = sort { my $c = %{ $ref_HoH->{$a} }; my $d = %{ $ref_HoH->{$b} }; print "comparing $c to $d...\n"; $c <=> $d; } keys %$ref_HoH; __END__ comparing 1/8 to 1/8... comparing 1/8 to 1/8... comparing 1/8 to 1/8...

See what's happening? (Also note that I've fixed your incorrect usage of the reference; under warnings you would also had spotted the error). You seem to want to sort by the keys or the values of the inner hashes. In fact the order you want is also the one you'd get if you sorted the inner values reverse-alphabetically. But that isn't clear in your post.

--
David Serrano