Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: exists on hash autovivifies right?

by menolly (Hermit)
on Jun 30, 2008 at 21:18 UTC ( #694834=note: print w/replies, xml ) Need Help??


in reply to exists on hash autovivifies right?

I've taken advantage of short-circuiting operators to deal with this in the past, like so:
if (exists($x->{a}) && exists($x->{a}->{c}) { #do stuff }

Might get annoying if your hash is particularly deep, though.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2020-10-20 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (209 votes). Check out past polls.

    Notices?