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