my @industrycodes = sort keys %db; foreach $i (@industrycodes) { print "Suppliers in the $db{$i}{industry}:\n"; my %s = %$db{$i}{suppliers}; # Note that: We wanted the hash of suppliers, # so we had to dereference with the hash sigil, % # The dereferencing of the references used for the # nesting is all handled automatically by the # subscripting syntax, so you don't have to mess # with it, but when you want to retrieve something # other than a scalar (e.g, an array or hash), # you do have to dereference the retrieved result. foreach $supplier (sort keys %s) { print "\t$supplier => $s{$supplier}\n"; } }