If you want to modify the value of a built in, you must you local to do it, and then the modification will be local to the enclosing code block.
A better approach, which doesn't suffer from the problems of dynamic scoping with local, would be to use the lexically scoped (no) warnings pragma instead for this particular situation - see perllexwarn
In reply to Re^2: Error: Can't use global $^W in "my"
by calin
in thread Error: Can't use global $^W in "my"
by Likeless
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |