in reply to HTML::Parser API script or module

You are looking for XML::XPath, which can sit on top of XML::Parser or XML::LibXML.

XPath expressions are a W3C standard for queries against XML in a regex-like syntax:

//a@href # select all a tags with a href= attribute //table/tr/td/a # select all a tags in a table