in reply to Re^14: Why is the execution order of subexpressions undefined?
in thread Why is the execution order of subexpressions undefined?
...to see why this is bad, substitute each call of f() in the print statement with its definition...my $i = 1; sub f {$i += 1; $_[0] * $i} print f(2) + f(3);
...notice that there are two assignments which refer to the same variable on the RHS, which violates our anti-EOD criteria from above.print do{$i += 1; 2 * $i} + do{$i += 1; 3 * $i};
|
|---|