in reply to Read from a file and replace

You are just opening a file for reading instead of writing.

try something like this (there are a zillion ways to do it):

open (FH, "file.html"); my $find = quotemeta('here.company.com/pagedir'); ## you can use quotemeta like this. my $replace = 'there.company.com'; ## also it is better to define these outside of your loop my $outstring; ## this is a temp variable while (<FH>) { my $string = $_; $string =~ s/$find/$replace/g; $outstring .= $string; ## this concatenates $string to $outstring } close (FH); open (FH, ">file.html"); ## > means open new file for writing print FH $outstring; ## a plain 'print' prints to STDOUT. you want to print to ## your filehandle instead. close (FH);
you _may_ want to change the line above to:open(FH, ">file.html.bak"); or something just for safety purposes.

umm, yes. i hope this explains things. no one yell at me if this is too obtuse.

chiller