my $parser = XML::LibXML->new(); $parser->recover(1); # Set recovery on error flag $parser->parse_html_string(join "", <>)->toStringHTML;