in reply to Re: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
in thread Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
Wild guess here but since the anonymous array is on the right side of a list operator, then the comma has really low precedence -- lower than assignment. By adding the +0, you give both terms equal precedence so it goes back to leftward precedence? Well ... that's my guess.
-derby
update: what Eily says makes better sense given the simple example of
use Data::Dumper; my $c = 0; my $d = [ $c, $c += 2 ]; print Dumper( $d );
In Section
Seekers of Perl Wisdom