Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by FunkyMonk (Chancellor)
on Nov 27, 2007 at 23:24 UTC ( #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? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-01-29 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?