Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Edit: ikegami is right, I mistook precedence for evaluation order, and just kept being blinded by that mistake. Please read his correct explanation. If you look at the precedence list in perlop, += is of higher precedence than ,, so it will be run first, just like the multiplication will be run before the addition in $c+$c*$_ In $c+0, $c+=1; + is the highest precedence operation, so addition is indeed run first. In $tmp = $c, $c+=1; = and += are of equivalent precedences, and so are run from left to right (and that's because of the , in between). Edit: added a ; here and a ; there, because their absence made my post look confusing.
In reply to Re: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
by Eily
|
|