my %domain_stats = ( 'www.perlmonks.com' => { 'country' => 'USA', # ... other very much needed fields ... }, 'www.google.ca' => { 'country' => 'Canada', }, 'www.foobar.com' => { # does this one exist even? ;) 'country' => 'Nebukadnezaria', }, ); for (sort {$domain_stats{$a}{country} cmp $domain_stats{$b}{country}} keys %domain_stats) { print "Domain: $_; Country: $domain_stats{$_}{country}\n"; }