The difference is that in for my $x (1) {...} the 1 is a literal constant. (0..1) on the other hand is an expression evaluating to the list (0,1). The loop is aliasing to the anonymous elements of the list, not to the literal boundaries in (0..1).
Perhaps it is helpful to consider that for my $x (0,1) {...} also dies with Modification of a read-only value attempted at -e line 1.
In reply to Re^3: Modification of a read-only value attempted?!?
by haj
in thread Modification of a read-only value attempted?!?
by kikuchiyo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |