foreach my $k ( keys %{$hoh} ) { if( $hoh->{$k} and values %{$hoh->{$k}}) { print "$k\n"; }; }