use XML::LibXML; my $parser = XML::LibXML->new(); $parser->recover(1); $parser->recover_silently(1); my $doc = $parser->parse_html_string($stuff);