in reply to Dynamic Table

Two things:
  1. use CPAN! This includes using CGI as well as the strict and warnings pragmas.
  2. Insert the items by columns then rows -- not by rows and then columns.
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 : '&nbsp;' ; $col_lable += 1; $nav_count += 15; } } print header, start_html('Build Table.pl'), table({cellpadding=>4,border=>1}, map {Tr[td[@$_]]} @table), end_html, ;
I am sure there is more refactoring that could be done, but this should get you started. ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: Dynamic Table
by Dufonzo (Initiate) on Feb 01, 2003 at 23:24 UTC
    Thanks,

    Very cool, just the kind of input I'm interested in.

    -D