Math 210 A Simple Web Form Using Perl

What is your first name?

How old are you?

This computes your age 11 years from now.


---- BEGINNING of SCRIPT -----

When you submit this form, your data is then processed by the script: web_script1.pl (see the line <form ...> in the SOURCE of the above form). This script is in the cgi-bin directory. Here is its contents.
#!/usr/bin/perl
push(@INC,"/www/cgi-bin");
require "cgi-lib.pl";

#-------------------------- What This Does ----------------------------
# Input data:  users first_name and age
# Output:      age + 11
#---------------------------- Main Program ----------------------------
# The subroutine &ReadParse" (from the external utility program
# cgi-lib.pl) gets the data that was just submitted and makes it
# available to you.  For instance  $in{first_name}  has the first name.
&ReadParse;

# The subroutine  "&PrintHeader"  (also from cgi-lib.pl)  is essential
# to print output to the user's screen.
print &PrintHeader;

$Name = $in{first_name};
$age = $in{age};
$age=$age+11;

print <<"ZZZ";	# Prints through the line with "ZZZ"
<html><head><title>Math 210, Perl Web Example 1</title></head>

<body bgcolor=white>
<center>
<H2> Output for Perl Web Example 1</H2>
</center>
<I>Hi $Name. In eleven years you will be</I> <b> $age</b> <I>years
old</I>.

<P>
I've got to go back to work now. Bye Bye.
</P> 
</body></html>
ZZZ
---- END of SCRIPT -----