in reply to Re: question 1st - undefined behaviour (perlop)
in thread question 1st - undefined behaviour

if you talking about operators precedence, so we can calculate that expression by the next way:
$x + ++$x + $x++:
first:
++$x - ok, at now here returns 6.
second:
$x++ - ok, at now here return 6, but $x will right now is 7 so we must get 21, if anywhere we get $x object as is, -but it isn't so.
we can get 19, if we get values, not objects - i've mean 7+6+6
we will get
5(value of copy of the object before any object changes)+7(at this position is value of original object $x)+6(at this position copy of $x after we make ++$x) == 18 - by logic which I describe.

Let's make first other operation - $x++ not ++$x - we get 5 here anyway.
then we make ++$x ($x == 6 ) - ok - we get 7 here. 7+5==12.
for getting at now 18 as a result we must take $x==6 - look's like it is absolutely wrong.

so..
by operators precedence from perlop(at perldoc) we can say that we calculate it from left to right.
why in position of $x - we get value of copy $x not for the moment of calculation, but for the moment of expression calculation begin.
  • Comment on Re^2: question 1st - undefined behaviour (perlop)