in reply to Using Perl to snip the end off of HTML
I don't know if it will help you, but check out HTML::PrettyPrinter.
the lowliest monk