Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Or, Or, Equals Zero, $x ||= 0

by FunkyMonk (Chancellor)
on Nov 27, 2007 at 23:24 UTC ( [id://653415]=note: print w/replies, xml ) Need Help??


in reply to Or, Or, Equals Zero, $x ||= 0

$x ||= 42 is read as "if $x is false (empty string, 0 or undef) store 42 into $x". This construct has always had problems when used to assign a default value (what if you want $x to be zero) that will soon be solved by the "defined-or" operator, //, arriving soon in perl 5.10.0.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-25 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found