use warnings; use strict; use File::Find my $curUrl = "http://localhost:8080"; my $tarUrl = "http://localhost"; sub process_files { next unless -f $File::Find::name; print "Processing $File::Find::name\n"; open FILE, "+>", $File::Find::name or die "Could not open file $File::Find::name"; while (my $line = ) { $line =~ s/$curUrl/$tarUrl/g; } close FILE; } find( &process_files, $ARGV[0] );