Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: $1 not "freezing" in an addition

by ikegami (Pope)
on Dec 16, 2012 at 14:36 UTC ( #1009069=note: print w/replies, xml ) Need Help??


in reply to Re: $1 not "freezing" in an addition
in thread $1 not "freezing" in an addition

What happens? You might expect that you'd get output like this:

The example you gave has nothing to do with operand evaluation order and everything to do with operator precedence. Your code is equivalent to print(foo(+bar(), "\n"));, for which operand evaluation order *is* defined.

If you had used print foo() + bar(), "\n"; (or added the empty prototype, as you mentioned), then you would be relying on undefined operand evaluation order, yet it will give you the following on all machines:

foo just happened bar just happened 42

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009069]
help
Chatterbox?
[Corion]: Discipulus: Aaah, no, while I'm working on connecting the VR libraries to Perl, I'm not lost there ;) Although I watched The Matrix with a friend in London ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2016-12-06 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (101 votes). Check out past polls.