in reply to printing all values in a hash of hashes of arrays
use warnings; use strict; my %hash_of_hash_of_arrays = ( 'key' => { 'innerkey2' => [ 'here' ], 'innerkey3' => [ 'there' ], 'innerkey1' => [ 'hello', 'world' ] } ); foreach my $outerkey (keys %hash_of_hash_of_arrays) { print "'$outerkey'\n"; foreach my $innerkey (keys %{ $hash_of_hash_of_arrays{$outerkey} }) +{ # <---- added curlies print "$innerkey\n"; foreach my $array_item (@{ $hash_of_hash_of_arrays{$outerkey}{$inn +erkey} }) { print "array item: $array_item\n"; } } } __END__ 'key' innerkey2 array item: here innerkey1 array item: hello array item: world innerkey3 array item: there
For output order predictability, you can sort keys.
|
---|