use strict; use warnings; use CGI::Pretty qw(:standard); my $total_cells = 517; # would be recordset my $display_cells = $total_cells / 15; my $row_count = 10; my $col_count = $display_cells / $row_count; my $col_lable = 1; my $nav_count = 15; my @table; for my $c (0..$col_count) { for my $r (0..$row_count-1) { $table[$r]->[$c] = ($nav_count < $total_cells) ? a{href=>"mypage.html?nav=$nav_count"},$col_lable : ' ' ; $col_lable += 1; $nav_count += 15; } } print header, start_html('Build Table.pl'), table({cellpadding=>4,border=>1}, map {Tr[td[@$_]]} @table), end_html, ;