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

Re: shift and logical or

by GrandFather (Sage)
on Nov 20, 2012 at 00:46 UTC ( #1004639=note: print w/ replies, xml ) Need Help??


in reply to shift and logical or

Do you understand Perl's logical ||? The key point in the context you are having trouble understanding is that the tested value is returned. Other languages with a logical or return a boolean value. Perl returns the actual value. So:

0 || 'wibble'

returns the string wibble, not 1, -1 or true as you might get in other languages. That makes logical or very useful for providing default values.

True laziness is hard work


Comment on Re: shift and logical or
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-02 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls