Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Autovivification with hash of hashes

by Aristotle (Chancellor)
on Jan 26, 2003 at 05:34 UTC ( #229942=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Autovivification with hash of hashes
in thread Autovivification with hash of hashes

Here you are strongly suggesting a symblic reference. As for the code, the part before && obviously evaluate to false, so that exists after && will be evaluated, but no auto-vivfication here, as $foo{bar} has been created by you earlier

Actually, a) the ref failing will immediately lead to the entire expression failing because he is using &&, not ||. b) If it got executed, strict would cause the exists to fail with a refs stricture violation.

And the latter is exactly what he's talking about protecting against by using ref.

Makeshifts last the longest.

  • Comment on Re^3: Autovivification with hash of hashes

Replies are listed 'Best First'.
Re: Re^3: Autovivification with hash of hashes
by trs80 (Priest) on Jan 26, 2003 at 23:14 UTC
    Thank you, that is what I was trying to convey.

    I think the most important thing to do when working with structures that may contain anonymous hash refereneces is to avoid using tests that access a possibly non existent hash reference key by name, which, as far as I know, is the only way to cause autovivification. I am not sure what, other then ref could even be used. This link provides some extended examples on the subject.
    Autovivification Explained

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://229942]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-01-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (217 votes). Check out past polls.

    Notices?