in reply to how to split html printout into two table cells

One useful trick for this sort of problem is using the modulus operator, %:
use constant MAX_ITEMS_PER_COLUMN => 25; my @list = (1..50); my $numcols = int(@list / MAX_ITEMS_PER_COLUMN); print "<table><tr>\n"; for(my $i=0;$i<@list;$i++) { print "<td>$list[$i]</td>"; if ($i % $numcols == ($numcols - 1)) { # Start a new row print "</tr><tr>\n"; } } print "</tr></table>\n";