#!/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 = "