Withnail has asked for the wisdom of the Perl Monks concerning the following question:
Perhaps I have constructed the hash incorrectly? I feel the answer is more likely that my inner loop 'for' is set up incorrectly or that its inner-most print statement is incorrect. I searched all over for an example of a 3D hash, but have found nothing. Is this possible in Perl!!?!?%ThreeD = ( TV => { version3 => { lead => "fred", pal => "barney", }, }, ); # print the whole thing foreach $media ( keys %ThreeD) { print "$media @ {"; for $media_ver ( keys %{ $ThreeD{$media_ver} } ) { print "$media_ver { "; for $leaf_obj ( keys %{ $ThreeD{$media{$media_ver}} } ) { print "$leaf_obj=$ThreeD{$media}{$media_ver}{$leaf_obj} "; } } print "}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 3D Hash
by kyle (Abbot) on Jul 14, 2007 at 05:38 UTC | |
|
Re: 3D Hash
by BrowserUk (Patriarch) on Jul 14, 2007 at 05:44 UTC |