foreach my $key1 (keys %hash) { print "$key1:\n"; foreach my $key2 (keys %{$hash{$key1}}) { print " $key2:\n"; foreach my $key3 (keys %{$hash{$key1}{$key2}}) { print " $key3:\n " , join (",",@{$hash{$key1}{$key2}{$key3}}), "\n"; } } }