With due respect to ikegami and all other monks, I strongly disagree with ikegami for the following reasons.
| Print order | O/P in Perl |
|---|---|
| $x | 0 |
| $x,$x++ | 10 |
| $x,$x,$x++ | 110 |
| $x,$x++,$x++ | 201 |
| $x,$x++,$x++,$x++ | 3012 |
| $x,$x++,$x++,$x++,$x++ | 40123 |
| $x,$x++,$x++,$x++,$x++,$x++ | 501234 |
works properly? Why in this case $x++ is NOT incrementing $x before print is called?my $x =0; print $x++; #prints 0 print $x++; #prints 1
If you keep the explanation I posted at Re: print behavior in mind, there is NO harm in modifying a variable in a parameter list expression when the variable appears elsewhere in that parameter list. Isn't it a nice obfuscation.
In reply to Re^2: print behavior
by atemon
in thread print behavior
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |