Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Printing from a hash table

by soonix (Canon)
on Jun 03, 2020 at 08:51 UTC ( [id://11117633]=note: print w/replies, xml ) Need Help??


in reply to Printing from a hash table

  • As haukex already stated, exists is superfluous, as keys can give you existing keys only, to loop over
  • for this purpose, undef and empty (and zero) are to be handled the same, you can simply test if/unless $birthdays{$name}. See Scalar values in perldata:
    A scalar value is interpreted as FALSE in the Boolean sense if it is undefined, the null string or the number 0 (or its string equivalent, "0"), and TRUE if it is anything else. The Boolean context is just a special kind of scalar context where no conversion to a string or a number is ever performed.
(and just as I am composing this, Tux beat me to it :-) too much research and interruptions :-(

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found