package HTML::Table; use CGI; my $cgi = CGI->new(); sub map_rows (@) { my $n = splice(@_, 0, 1); push(@_, '' x (-@_ % $n)); my @table_rows = map {$cgi->Tr( $cgi->td( [splice @_, 0, $n] ) ) } 0..((@_/$n) - 1); } sub make_table { my ($columns, @elements) = @_; return $cgi->table( map_rows $columns, @elements ); } 1; #### use HTML::Table; my $table = HTML::Table::make_table(5, qw[some random data to test the table creation thing] ); print $table; ####
some random data to test
the table creation thing