Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: How should I understand scalar(%hash) results?

by thospel (Hermit)
on Oct 05, 2004 at 09:08 UTC ( [id://396526]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How should I understand scalar(%hash) results?
in thread How should I understand scalar(%hash) results?

In normal programs the only interesting thing about this is that it's guaranteed to return false for an empty hash and something that's true otherwise. So you can check if a hash is empty or not by simply using the hash name in boolean context (which is a scalar context):
if (%hash) { ..do something for a filled %hash... } else { ...do something for an empty %hash... }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found