in reply to Trying to parse html file

How about using the proper tool for the job, like an HTML parser: HTML::Parser. Actually, I like HTML::TreeBuilder myself, it's a layer above HTML::Parser that makes it even easier to process the HTML. This way you don't have to bother about multi lines content, comments, weird HTML markup and the likes.