for my $key1 (sort keys %myhash) { print $key1, "\n"; for my $key2 (sort keys %{$myhash{$key1}}) { print "\t", $key2, " => ", $myhash{$key1}{$key2}, "\n"; } }