in reply to Parsing semi-complex HTML

With XML::LibXML, it would be

for my $node ($doc->findnodes('//*[@class="className"]')) { print($node->toString()); }

If you want to use HTML::Parser (e.g. if the HTML isn't valid), don't use it directly. Use HTML::TreeBuilder instead. It creates a tree of HTML::Element objects, whose look_down and as_HTML method you could use.