#!/usr/bin/perl -w use strict; print "Content-type: text/html\r\n\r\n"; # generate an HTML table of the powers of 2,3 and 4 my @rows = html_row("white"," n ", "nth power of 2", "nth power of 3", "nth power of 4"); for (0 .. 10) { if ($_ % 2) { push @rows, html_row("#cccccc",$_,2**$_,3**$_,4**$_); } else { push @rows, html_row("#ccccff",$_,2**$_,3**$_,4**$_); } } my $table = html_table(1,"",@rows); my $table2 = html_table(0,"black",html_row("",$table)); print "Here are the powers of 2, 3 and 4

\n"; print "$table2"; # This subroutine will print out a table row sub html_row { my $color = shift; my $rowP = ""; $rowP .= join("", @_) . "\n"; return $rowP; } # This subroutine will print out an HTML Table sub html_table { my $border = shift; my $color = shift; my $tableP ="\n"; $tableP .= join('', @_) . "
\n"; return $tableP; }