HTML::Clean module cleans up HTML code for web browsers, not humans.
$h = new HTML::Clean($filename); # or..
$h = new HTML::Clean($htmlcode);
$data = $h->data();
The HTML::Clean module encapsulates a number of common techniques for minimizing the size of HTML files. You can typically save between 10% and 50% of the size of a HTML file using these methods. It provides the following features:
Remove unneeded whitespace (begining of line, etc)
Remove unneeded META elements.
Replace tags with equivilant shorter tags (< strong > --> < b >)
The entire proces is configurable, so you can pick and choose what you want to clean.