All you really needed was
then you copy/pasteprint "local \$$_ = \$$_;\n" for @listofvarnames;
local $blah = $blah; ...
Although it is not a perfect solution - it seems to be working.
The use of global variables is red flag. Your statement that "it seems to be working" also indicates that it doesn't come with a test suite, another red flag. I think now is a time to consider/plan to refactor this program.
In reply to Re^5: Local $$_?
by Anonymous Monk
in thread Local $$_?
by expresspotato
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |