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

Re: Short Circuit Operator and Hash Assignment

by jonadab (Parson)
on Mar 17, 2004 at 18:24 UTC ( [id://337451]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Short Circuit Operator and Hash Assignment
in thread Short Circuit Operator and Hash Assignment

this seems a rather dangerous and naive optimization to me

The optimization is a red herring; it's not changing the result in any way. If the left operand of the && operator is true in boolean context, then it returns the value of its right operand, whatever that may be. Expecting it to return the left operand is wrong. (What you really were expecting is a different parse, based on different operator precedence. (See my other post downthread.))


;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$;[-1]->();print

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found