in reply to perl loops + html tables

You're almost there. Adding something to open and close a <tr> at the right point should help:
print "<tr>"; for (my $i = 0; $i<@values; $i++) { if (($i % scalar(@column_names)) == 0) { print "</tr>\n<tr>"; } print "<td>$values[$i]</td>\n"; } print "</tr>";
code is UNTESTED.
The $i % 3 equals to 0 if $i is 0 or 3 or 6 or 9 or ...

Replies are listed 'Best First'.
Re^2: perl loops + html tables
by Juerd (Abbot) on Jan 10, 2005 at 13:29 UTC

    code is UNTESTED.

    And wrong. While the output you generate is useful, it's not what the OP specified. You forgot to output the column names and probably didn't look at the example output at all, as that specifies horizontal "columns". Turning a table 90 degrees results in messier code than the nice looking thing you produced.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }