No there's only one (nested) hash. %test
To print a hash for debugging:
print "@{
}\n";
from that you'll get back references to the contained hashes, so really you want to loop through the hash keys
foreach my $key (keys %test) {
my $ref = $test{$key};
}
to get the references $ref, then dereference that
foreach my $nextkey (keys %$ref) {
my $nextref = $test{$key}{nextkey};
}
As you know the depth of hashing you can avoid using the ref() function to determine if a reference or a scalar vale has been returned by $test{$key}.