in reply to DBI output in 3 columns

This code pretty much meets your specs. It can handle 0-600 data items. I've left DBI specifics out for illustration purposes. Not pretty, but clear. Would've been less kludgey if it were 1-600 instead of 0-600.
my $ctr = 0; for ($ctr = 0; $ctr < 601; $ctr++) { $indexs[$ctr] = "-$ctr-"; } $ctr = 0; print "<html><body><table border=1>"; while ($ctr < 201) { print "<tr><td>"; if ($indexs[$ctr]) { print $indexs[$ctr]; ### first col current row ($ctr) } else { print '&nbsp;'; } print '</td><td>'; if (($indexs[$ctr + 201]) and ($ctr+201 != 401)) { print $indexs[$ctr + 201]; ### second col current row ($ctr) } else { print '&nbsp;'; } print "</td><td>"; if ($indexs[$ctr + 401]) { print $indexs[$ctr + 401]; ### third col current row ($ctr) } else { print '&nbsp;'; } print "</td></tr>\n"; $ctr++; } print "</table></body></htm>\n";