"...is there any compelling reason not to do a "local $_;" at the beginning of every subroutine?"
Yes, doesn't fix the problem. Any time you call a function, subroutine or method it could blow away $_. And you will never have control of other peoples code so if you rely on $_ not being hosed you'll eventually get burnt. Far better is to practice defensive programing and not rely on $_ after all the perl syntax in all cases allows you to specify something other that the default input/output scalar.
In reply to Re^3: cpan install($_) doesn't work in loop, but normal lexical var does
by starbolin
in thread cpan install($_) doesn't work in loop, but normal lexical var does
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |