You're probably doing a lot more work in Perl than you really have to do. Try leveraging the power of command line tools to your advantage. I bet you could do what you want with a single command line.
find /path/to/dir -name '*.pm' | xargs perl -i.bak -n -e 's/original/n +ew/; print;'
The find command is going to spew out a list of files. The xargs command is going to invoke perl with the switches specified, and drop the list of files on the end of the command line. For perl: the -i switch specifies in place editing, and copies the originals to files with the .bak extension added; -e specifies the code you're going to execute; -n specifies an implicit while (<>) { ... } around the stuff specified by -e.
I am constantly amazed by the incredible power that I can wield with a single, well constructed command line. However, as an addendum, your initial statement, "I need to go through a large amount of perl files to change certain paths and urls contained in them", makes me curious... Could you have created a common file that contained constants that all of your scripts might have included? It sounds like you might have committed the cardinal sin of hard coding constants all over your code, when a single hard coding and then repeated reference thereto would have been a far more maintainable solution.
In reply to Re: Changing lots of files...
by skyknight
in thread Changing lots of files...
by arrow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |