foreach my $k1 ( keys %{ $hash{'prefix'} } ) { for my $k2 ( keys %{ $hash{$k1} } ) { print("$k2\n"); } }