in reply to Re: •Re: "for" surprise
in thread "for" surprise

Perhaps you forget that Perl is not DWIM, but DWLM (Do What Larry Means).

Luckily, Larry has given us notes about what he wants Perl to do. {grin}

Seriously, the localization is an important positive property of foreach loops, and something that while you may have just learned, has been a property of foreach loops since Perl version 1.

Asking for a warning on the locallization there would be like getting a warning on an assignment operator because "the value of the variable has now changed!". No, not gonna happen. Sometimes, you have to think for yourself, and learn what there is to learn about the language.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.