in reply to Re: Looping through a hash reference is creating a key...?
in thread Looping through a hash reference is creating a key...?
To prevent autovivification, one would have to test exists $h{1} and only if it were true, examine $h{1}{2}. However, they could just test whether $h{1} were true and get pretty much the same result -- if it didn't exist before, it won't exist after. The only difference in using exists is if $h{1} has a non-reference value like zero, empty string, or undef. It seems a little odd to dereference it in those cases. Perhaps a better idea would be to test it with ref.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Looping through a hash reference is creating a key...?
by perrin (Chancellor) on Jun 10, 2004 at 19:19 UTC | |
by thor (Priest) on Jun 10, 2004 at 20:20 UTC | |
by dave_the_m (Monsignor) on Jun 10, 2004 at 22:36 UTC | |
by Roy Johnson (Monsignor) on Jun 12, 2004 at 01:12 UTC | |
by ihb (Deacon) on Jun 13, 2004 at 17:18 UTC | |
|