in reply to Any Alternative to HTML::TreeBuilder::XPath?

XML::LibXML can parse HTML if told to, but only if your HTML is more or less well formed and valid. Adding the recover option makes it a bit more robust:
#!/usr/bin/perl use warnings; use strict; use XML::LibXML; my $dom = 'XML::LibXML'->load_html(string => << '__HTML__', recover => + 1); <html><h1>Hello world</h2></html> __HTML__ print $dom->findvalue('/html/body/h1/text()');

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Any Alternative to HTML::TreeBuilder::XPath?
by sumeetgrover (Monk) on Oct 03, 2017 at 13:40 UTC

    Thanks! This one works exactly how I need to query XPath. Although the HTML I am parsing is malformed (blame the other developer!), this is a really good solution!