In the case of for my $x (1) { }, the variable $x is a reference to the value in brackets which is constant.
Consider this: perl -le "my $y = 2; for my $x ($y) { $x = 1; print $y }" When we change $x, we change the underlying $y. So the output is 1
In reply to Re: Modification of a read-only value attempted?!?
by Bod
in thread Modification of a read-only value attempted?!?
by kikuchiyo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |