You really ought to be doing this with HTML::Parser.
In reply to Re: Problem with parsing HTML with Regex's by ysth in thread Problem with parsing HTML with Regex's by OverlordQ