the list assignment returns the length of the list in scalar context, so
DB<114> $l = ( @a = qw/a b/ )
=> 2
So it's not the same code!
The difference between your code and my example is that there is no explicit variable (like $l) used here, but somehow it's still possible to change it.
Maybe it's a side effect of for ? I dunno.
I'd prefer a Can't modify warning here too!
But it's still a very peculiar construction, so I'm not surprised if this edge case wasn't covered.
HTH!
update
More insights:
... it's not the temporary scalar which is modified but the resulting list in brackets
DB<121> print "$_\n" for ($a=666) x= 2
666
666
=> ""
DB<122> $a
=> 666
According to the already cited documentation of "combined assignments" this shouldn't be possible, b/c its a list operation. |