I poked around HTML::TreeBuilder, but my goodness, things are complicated. It may not seem like it to seasoned monks, but to a C programmer, the OO aspects and data structures of perl are, well, daunting.
Gleaning how to do something as simple as the one I posted here from the perl module docs is almost always an excercise in frustration.