in reply to Re^2: Modifying hash keys via aliasing
in thread Modifying hash keys via aliasing
Just as I would also have expected a warning saying something like "attempt to modify read-only value" with the following pieces of code:
But there is no warning. On the other hand, you get a warning with this:$ perl -Mstrict -wE 'say ++$_ for 1..4;' 2 3 4 5 ~ $ perl -Mstrict -wE 'say $_ for map {++$_} 1..4;' 2 3 4 5
There must be some reason, but it does not look very consistent to me.$ perl -Mstrict -wE 'say $_ for map {++$_} (1, 2, 3, 4);' Modification of a read-only value attempted at -e line 1.
|
---|