in reply to perl loops + html tables

Pedantry: they are not COLS when they are horizontal ! They are ROWS ! ;-)

I'm very new to HTML::Template but think it would work very well for you in this scenario.
There is an example of a vertical table at
http://html-template.sourceforge.net/article.html
and I don't think it would take a lot to transpose it for your purposes.

Long story short, you will need to set up the data so that you are passing an array to the template. That array will hold references to hashes which will hold your data.

Note: I had some initial teething problems with HTML::Template which were caused by passing veriables to a template but not using them within the template. Other than that "it does what it says on the tin".