use WWW::Mechanize;
use HTML::TreeBuilder::XPath;
my $mech = new WWW::Mechanize;
my $tree = new HTML::TreeBuilder::XPath;
my $url = "http://www.elaws.gov.bw/wondersbtree.php";
$mech->get($url);
$tree->parse($mech->content());
@nodes = $tree->findnodes("//p[font = 'PRINCIPAL LEGISLATION']");
print @nodes[0]->as_HTML;
The above code prints out the HTML element searched for, but it is missing the final </p> tag. Why? Is this intentional or is it a bug in the module?
In HTML, the end tag is optional for P elements.