Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
"be consistent"
 
PerlMonks  

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

by TVSET (Chaplain)
on Oct 05, 2004 at 04:47 UTC ( [id://396521]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Oh, thanks. I guess I missed this bit somehow...
  • Comment on Re^2: How should I understand scalar(%hash) results?

Replies are listed 'Best First'.
Re^3: How should I understand scalar(%hash) results?
by thospel (Hermit) on Oct 05, 2004 at 05:08 UTC
    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://396521]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.