in reply to Cleaning up HTML

HTML::Tidy is a nice Perl-wrapper around HTML Tidy. It allows you to filter and ignore certain warnings and error-messages, so perhaps you can make it dealing only with the "cruft" you wish to change?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James