Hello, I am currently frustrated trying to do a simple find and replace
on a file, but the three open options: Read, Write and Append don't seem
to give me what I want. For example, Read, works on the finding, but
nothing will replace. Write erases all the files and leaves me with
blank files and append adds to the end.
 
I tried something like:
 
open(MYFILE,'+<',$myfile);
 
and that didn't work. If you are interested here is my code:
.. . .
open(HTMFILE,'+<', $filename) or die "Can't Open: $!";            # now
go through all .htm files and make changes
                  while (<HTMFILE>) {
                        $_ =~ s/leftmargin="0".*bgcolor="#3c3939"//g;
                        $_ =~ s/bgcolor="\#5A5D4E"/class="topOfPic"/ig;
                  }
                  close(HTMFILE);
                  . . .
 
any thoughts . . ?
 
thanks,
 
tim


Reply via email to