in reply to Add line numbers to HTML

It's not entirely clear to me where you want your line numbers. If you just want them where a :set number would put them, then you don't need to parse the file - the code is simple:
$cnt=1; while (<>) { print sprintf "%5d%s",$cnt++,$_; }
Of course, that might make for some invalid HTML - like if a tag is broken across a newline (Frontpage seems to be fond of doing that).

If you're looking for numbers in the HTML after it has been rendered into text, look up HTML::FormatText.

If you want a number pre-prended to every line of the rendered HTML page in a browser, than I doubt you can do it. Particularly once tables get involved. Not because of the limitations of Perl, but because of the nature of HTML rendering.