in reply to Re^2: Modification of a read-only value
in thread Modification of a read-only value
:)
I first saw this in a question in the monastery a long time ago. That was a far nastier case, though: someone was getting spurious action at a distance. Turns out one of his map blocks was calling a sub containing a while(<FH>), and because map aliases $_, the function modified the values in his source array. Ouch.
Ever since, while(<FH>) used without a local has been a red flag in my mind. Always localize $_ when you use this construct. (Or use a different variable, as you did, of course.)
Makeshifts last the longest.
|
|---|