Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Assigning the result of a chomp to the chomped var itself.

by ikegami (Patriarch)
on Nov 26, 2014 at 14:29 UTC ( [id://1108456]=note: print w/replies, xml ) Need Help??


in reply to Assigning the result of a chomp to the chomped var itself.

Generally speaking, you should avoid reading and modifying a variable in the same expression. You run into tricky and undefined areas.

For many operators, operand evaluation order is undefined. While it's not explicitly defined for the assignment operators, the fact that local $x = $x; is guaranteed to work strongly implies that the RHS side of that operator is evaluated before its LHS.

As such, there's a strong implication that the observed behaviour is a bug.

Update: LHS being evaluated first wouldn't cause $x to get cleared.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-19 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found