in reply to Don't Use Local
in thread nuances of my, and maybe local

I'm pretty sure local existed in Perl 3 as well, and maybe even Perl 2.

And you still need local to give a temporary value to a package variable, especially a special variable. For example, this is perfectly sane code:

my $slurp_file = do { local $/; # slurp mode... <SOME_HANDLE>; };
This works because the setting for $/ (a global variable) will be affected for only the duration of the block in which the local appears: just long enough to get the value.

So, it's not never use local, but rather, be sure you know when to use it (rarely) and when not to use it (mostly).

-- Randal L. Schwartz, Perl hacker