in reply to Parsing badly formed HTML

You could also give HTML::TokeParser [::Simple] a try.