in reply to html tables

I don't see a print "<td>\n";, fyi. I don't see \n anywhere for that matter, meaning your code would print in one long line. Also have you consider HTML::Template, it allows you get output normally from a database and, after pushing that into a hash, fill in the needed values in the table

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce