in reply to Multiplication table

Here is how i would do it. Don't print out the values as you calculate them - instead, store them in a 2-D array:
sub get_table { my $max = $_[0] - 1; my @table; for my $y (0..$max) { for my $x (0..$max) { $table[$y][$x] = ($x + 1) * ($y + 1); } } return @table; }
so that you can use existing CPAN modules to render them. For example, via Text::Table:
use Text::Table; my $max = shift || 12; my @table = get_table($max); my $text_table = Text::Table->new(1..$max); $text_table->load(@table); print $text_table->body;
or an XHTML table via DBIx::XHTML_Table:
use DBIx::XHTML_Table; my $max = shift || 12; print DBIx::XHTML_Table ->new([get_table($max)],[]) ->output({no_head=>1}) ;

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)