********** July 6th colorsv2.cgi (Version 2 of colors.cgi **********
#!/usr/bin/perl -w
use CGI qw(:standard);
# Written by Mark Jacobson on Thursday July 5th, 2001
# colors.cgi version 2 ---> colorsv2.cgi
# Illustrates Subroutines (Chapter 13), aka Functions (Hour 8)
# Array @c1 is used for the BGCOLOR value
# Array @c2 is used to the TEXT color value
@c1 = qw(Red Green Blue Black Purple Yellow White Pink Orange Brown);
@c2 = qw(Blue Yellow Yellow White Yellow Purple Black Black Black Pink);
($bgColor, $textColor, $recentColors) = &getColors;
print header,
start_html(-title => "BGColor $bgColor, Text Color $textColor",
-BGCOLOR => "$bgColor",
-TEXT => "$textColor"),
h1("This has background color $bgColor and text color $textColor"),
start_form,
"",
submit('Random Color'),
end_form;
if ($recentColors =~ m/:/)
{
$recentCount = $recentColors =~ tr/://;
print "\n