in reply to Changing lots of files...
"but i was wondering if there is a better, more efficient way of going through all the perl files and replacing a certain part in a line"The answer is yes... don't go to the bother of going through all your files in the first place ;). What I mean by this is create a module for yourself that acts like a config file and basically allows you to change any (and all) variables from one location.
Heres the steps:
package globalVars; # <- the name you chose use Exporter; @ISA = qw(Exporter); @EXPORT = qw( $PATH_FOO $URL_FOO ); # Some very good descriptive text about a path our $PATH_FOO = "/var/www/my/site/"; # Some very good descriptive text about a url our $URL_FOO = "http://www.foo.net/bar/baz.html";
#!/usr/bin/perl -w use strict; use globalVars; ....
Its just another TIMTOWTDI, and whilst in the short term it may seem a lot of work I'm sure you can see the advantages in so much as the next time you need to do editing, you change one file and all scripts are magically updated.
HTH ~ (well, its how I do it anyway... :)
(1) Which one you choose is up to you, everyone seems to have their favourite, you can always move it later.
|
|---|