It feels a bit kludgy but I'd love monks to help me clean it up if they have any ideas:
#!/usr/bin/perl use warnings; use strict; use HTML::Template; my $template = HTML::Template->new( filehandle => \*DATA ); my $total_cells = 101; my $max_column_height = 25; my $row_width = int( $total_cells / $max_column_height ); my @table = (); my @row_array = (); my %row_hash = (); for ( 1 .. $total_cells ) { push( @row_array, { content => $_ } ); if ( scalar(@row_array) == $row_width ) { my @array = @row_array; push( @table, { columns => \@array } ); @row_array = (); } } if ( @row_array ) { # if there's a row that's incomplete while ( scalar(@row_array) != $row_width ) { push( @row_array, { content => ' ' } ); } push( @table, { columns => \@row_array } ); } $template->param( table => \@table ); open( TABLE, '>table.html' ) || die($!); print TABLE $template->output(); __DATA__ <table border="1"> <tmpl_loop name="table"> <tr> <tmpl_loop name="columns"> <td><tmpl_var name="content"></td> </tmpl_loop> </tr> </tmpl_loop> </table>
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
In reply to Re: how to split html printout into two table cells
by Cody Pendant
in thread how to split html printout into two table cells
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |