Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Now when I print out the values for both 'obj1' or 'obj2' I get values from both. Am I doing anything wrong? I thought I would only get values contained under the particular one I wantfor($i=1;$i<4;$i++) { push(@{$test{obj1}{values}},$i); } for($i=4;$i<7;$i++) { push(@{$test{obj2}{values}},$i); }
Thanks, desperate soulforeach $key (keys %test) { foreach $tmpvalue (@{$test{$key}{value}) { print "$key --> $tmpvalue\n"; } } Output: obj1 --> 0 obj1 --> 1 obj1 --> 2 obj1 --> 3 obj1 --> 4 obj1 --> 5 obj1 --> 6 . . .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash of arrays
by Roy Johnson (Monsignor) on Apr 12, 2006 at 17:01 UTC | |
|
Re: Hash of arrays
by ikegami (Patriarch) on Apr 12, 2006 at 17:01 UTC | |
by Anonymous Monk on Apr 12, 2006 at 17:14 UTC |