exists tests for the existance of the last part of the expression. It will autovivify any earlier parts in the process. You need to code
<p><code> if(exists($foo{bar}{baz})) { print "\$foo{bar}{baz} exists\n"; }
as
if(exists($foo{bar}) and exists($foo{bar}{baz})) { print "\$foo{bar}{baz} exists\n"; }
to prevent it.
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
In reply to Re: Autovivification with hash of hashes
by BrowserUk
in thread Autovivification with hash of hashes
by Mr_Person
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |