Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Printing from a hash table

by soonix (Canon)
on Jun 03, 2020 at 08:51 UTC ( #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? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2021-10-25 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?