in reply to Hash of arrays
Did you run your code? It doesn't even compile. And once I fix the compile error by changing
foreach $tmpvalue (@{$test{$key}{value})
to
foreach $tmpvalue (@{$test{$key}{values}})
it worked as expected.
obj1 --> 1 obj1 --> 2 obj1 --> 3 obj2 --> 4 obj2 --> 5 obj2 --> 6
Maybe if you showed us your real code, we could find the error.
In your real code, either
In other words, you have something equivalent to the following in your real code:
$test{obj1} = \%data; $test{obj2} = \%data; # -or- # # $test{obj1}{values} = \@values; # $test{obj2}{values} = \@values; for($i=1;$i<4;$i++) { push(@{$test{obj1}{values}},$i); } for($i=4;$i<7;$i++) { push(@{$test{obj2}{values}},$i); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash of arrays
by Anonymous Monk on Apr 12, 2006 at 17:14 UTC |