Another approach is to ask Perl what it thinks about the code you've written (with further reference to perlop):
>perl -wMstrict -MO=Deparse,-p -le "my $x = 5; $x = $x + ++$x + $x++; warn $x; " BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use strict 'refs'; (my $x = 5); ($x = (($x + (++$x)) + ($x++))); warn($x); -e syntax OK >perl -wMstrict -le "my $x = 5; $x = $x + ++$x + $x++; warn $x; " 18 at -e line 1.
See O and B::Deparse.
In reply to Re: question 1st - undefined behaviour
by AnomalousMonk
in thread question 1st - undefined behaviour
by rumos2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |