Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

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


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 09: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
Node Status?
node history
Node Type: note [id://396521]
help
Chatterbox?
[marto]: Discipulus, what did you have in mind?
[marto]: sort of related, have you seen sonic pi
[Discipulus]: choroba less than perl -le ' $==1,(1 x $_)=~/(^)(1|11\1 )*(?{$=++})^/, print $= for 0..10'?? congrats
[Discipulus]: marto i had in mind something for stupid peoples with smart phones; a free app (this is the the non perl part..) and some hardware to sell in big cities
[marto]: use libPD on Android/IOS, route to something listening on the pi :P
[marto]: libpd
[marto]: OSC

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-10-17 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (225 votes). Check out past polls.

    Notices?