my %hash = (); my %innerhash = (); # Fills hashes with stuff $hash{$somekey} = \%innerhash; # Trying to loop through each key in inner hash foreach my $key (keys %hash) { while(my ($key1, $value1) = each (%{$hash{$key}}) ) { print "$key1 $value1\n"; } }