Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Why are "a ||= b" and "a = a || b" different?

by saintmike (Vicar)
on Mar 03, 2007 at 06:18 UTC ( [id://603036]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Why are "a ||= b" and "a = a || b" different?
in thread Why are "a ||= b" and "a = a || b" different?

Sorry, liverpole, looks like I totally sent you down the wrong alley.

It's not about undefined values or using strict.

If you leave out the my in my post, it makes better sense. What I wanted to say is that

($ret) ||= foo();
is different than
($ret) = $ret || foo();
regarding context.

Regardless if $ret is defined or not, foo() is in scalar context in the first statement and in list context in the second.

I've removed the my from the original post to make the intention clearer.

Log In?
Username:
Password:

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

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

    No recent polls found