my ($first_key) = keys %{$samplehash{$key}}; print "\n $key = " . $first_key; #### foreach $key (keys %samplehash) { print "\n$key = {\n"; foreach $subkey (keys %{$samplehash{$key}}) { print "\t$subkey = $samplehash{$key}{$subkey}"; } print "\n}"; }