IamAwesom3 has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks, I am trying to access multi dimensional array in hash. but I am not able to print the values seperately.
Output I get ismy ($key2,$item,$hash,$array); my %temp = ( "0x55555555" => { "0x55555555" => [ ["0xAAAAAAAA", "0x9"], ], "0xAAAAAAAA" => [ ["0xAAAAAAAA", "0x8"], ], }, "0xAAAAAAAA" => { "0x55555555" => [ ["0xFFFFFFFF", "0x8"], ], "0xAAAAAAAA" => [ ["0x55555554", "0x3"], ], }, ); foreach $item (keys %temp) { print "$item: \n"; my $hash = $temp->{$item}; foreach $key2 (keys %$hash){ my $array = $hash->{$key2}; for $i (0..$#$array){ print "$i: $$array[$i]\n"; } } }
0xAAAAAAAA: 0x55555555:
I want to access each and every element of the hash, How can I do that? Please help me. If you can explain it with a note then that will be great.
Thanks P
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to access Hash of hashes with multi-dimensional Array
by tobyink (Canon) on Apr 18, 2013 at 21:41 UTC | |
|
Re: How to access Hash of hashes with multi-dimensional Array
by 2teez (Vicar) on Apr 18, 2013 at 22:45 UTC | |
by IamAwesom3 (Initiate) on Apr 19, 2013 at 14:33 UTC | |
|
Re: How to access Hash of hashes with multi-dimensional Array
by TomDLux (Vicar) on Apr 19, 2013 at 01:31 UTC | |
|
Re: How to access Hash of hashes with multi-dimensional Array
by Anonymous Monk on Apr 19, 2013 at 01:54 UTC | |
|
Re: How to access Hash of hashes with multi-dimensional Array
by hdb (Monsignor) on Apr 19, 2013 at 14:53 UTC |