Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: question 1st - undefined behaviour

by Riales (Hermit)
on Sep 23, 2013 at 22:03 UTC ( #1055392=note: print w/ replies, xml ) Need Help??

in reply to question 1st - undefined behaviour

I think the first and second $x would be 6 actually, due to the prepend happening on the second $x.

Here are the steps in order:

1. ++$x: All $x are now 6.

2. 6 + 6 + 6

3. $x++: All $x are now 7.

4. $x = 18: The value from the 6 + 6 + 6 is assigned to $x.

Comment on Re: question 1st - undefined behaviour
Select or Download Code
Replies are listed 'Best First'.
Re^2: question 1st - undefined behaviour
by rumos2 (Novice) on Sep 23, 2013 at 22:21 UTC
    sorry if I making a mistake, but looks like you are wrong - why - try understand why
    my $x=5; $x=++$x + $x++ + $x; warn $x;
    return's 20.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2015-11-25 16:55 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (683 votes), past polls