Personally I try to avoid editing HTML files directly (in a CGI context that is). You might want to check
, which basically can insert script output in a HTML file (without actually changing the HTML file). The other way is have a pure CGI
... Quidquid perl dictum sit, altum viditur.