Here is a simple script I use when I have to make changes on multiple files that works pretty good. It uses the module File::Find. The way to use it is to change the $find variable to whatever it is you want to change, and change the $replace variable with what you want to replace it with. Give it a directory to work in with the $startdir variable, and last of all tell it the file type to match. This is great if you have oh say a hundred files that need a link or image or anything else for that matter changed.
#!/usr/bin/perl
#replace.pl find and replace on multiple files with the same extension in a directory
use strict;
use warnings;
use File::Find;
my $startdir = '/var/www/html/';
my $find = '/templates';
my $replace = 'templates';
my $doctype = 'php';
print qq~Finding "$find" and replacing it with "$replace"\n~;
find(
sub{
return unless (/\.$doctype$/i);
local @ARGV = $_;
local $^I = '.bac';
while( <> ){
if( s/$find/$replace/ig ) {
print;
}
else {
print;
}
}
}, $startdir);
print "All done";