Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Autovivification with hash of hashes

by Aristotle (Chancellor)
on Jan 28, 2003 at 11:46 UTC ( [id://230553]=note: print w/replies, xml ) Need Help??


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

This is broken. It will falsely return false for keys which exist but point to a value equal to 0 or the empty string.

Nor does it solve the problem at hand, because exists $hashref->{KEY} will not autovivify that key into a hashref either. It is only when you try something like exists $hashref->{LEVEL1}->{LEVEL2} that the level one key is automagically created. But in that case, defined $hashref->{LEVEL1}->{LEVEL2} will do the same.

So your "solution" adds a new problem without solving the existing one.

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://230553]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-19 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found