in reply to Read from a file and replace
Added code, and made some changes... The new file will be in newfile.html.
runrig's will work as well, and it significantly shorter.open(FH, "<file.html"); open(OUT, ">newfile.html"); my $line = ''; my $find = quotemeta("here.company.com/pagedir"); my $replace = "there.company.com/"; while($line = <FH>) { $string =~ s/$find/$replace/g; print OUT $string; } close(FH); close(OUT);
|
|---|