in reply to Pre vs Post Incrementing variables
Given my explanation of the problem, the workaround would be to convert the lvalue returns by the pre-increment operator into rvalues.
>perl -E"say ++$i,++$i;" 22 >perl -E"say 0+(++$i),0+(++$i);" 12
Technically, the operand evaluation order for the comma operator in list context is not defined, but it's not likely to ever change, especially since the operand evaluation order for the comma operator in scalar context is defined.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pre vs Post Incrementing variables
by JavaFan (Canon) on Sep 13, 2010 at 21:31 UTC |