use constant MAX_ITEMS_PER_COLUMN => 25; my @list = (1..50); my $numcols = int(@list / MAX_ITEMS_PER_COLUMN); print "\n"; for(my $i=0;$i<@list;$i++) { print ""; if ($i % $numcols == ($numcols - 1)) { # Start a new row print "\n"; } } print "
$list[$i]
\n";