in reply to Perl Replace Help

Well, for one thing, I don't see where you're writing the changes out to a file. You're reading the file in (implicitly) to $_, and then you're performing the substitution, and then you're moving on to the next line without ever writing the current line out to a new file.

The other issues that you're going to encounter include (but are not limited to):

Some of these issues were discussed in the Chatterbox when you asked there.


Dave

Replies are listed 'Best First'.
Re: Re: Perl Replace Help
by BUU (Prior) on Dec 04, 2003 at 17:41 UTC
    • Thats wonderful, but the Original Poster is not daling with html tags
    • It will change everything, granted, but it's still not html.
      • He's not parsing html, merely doing a text replace
      • It's still not html
      Anonymous Monk (who, in this case, I know through some CB conversations happens to be the same person as pilot_vijay, who is also the same person who asked about a dozen questions regarding the translating of pdf files and MS format files to HTML a few days ago) stated:
      I open a html file and find 2 strings in it...

      And went on to provide a code snippet that started like this...

      open html, 'test.htm'; while (<html>) { .....

      Perhaps I was reading too much into those clues, but it looked to me like he's trying to deal with HTML.

      I might as well add another nit to pick with the OP's code: Not checking the success or failure of the open.


      Dave

        Perhaps I jumped the gun, all I really saw was that
        body { text-decoration: none; text-indent: 0in; text-align: left; lang: en-US; font-weight: normal; font-variant: normal; color: #000000; font-size: 10pt; font-style: normal; widows: 2; font-family: 'Times New Roman'; }
        Part, which is clearly CSS. I think my other points regarding text replacement rather then parsing still hold however.