open(FH, "newfile.html"); my $line = ''; my $find = quotemeta("here.company.com/pagedir"); my $replace = "there.company.com/"; while($line = ) { $string =~ s/$find/$replace/g; print OUT $string; } close(FH); close(OUT);