print "<h1>Thank you for filling out the form</h1>";
$firstname =
$value[0];
$lastname = $value[1];
$email = $value[2];
print "Your first name is
$firstname<BR>";
print "Your last name is $lastname<BR>";
print "Your e-mail is
$email<BR>";
#***************END
BODY******************
The readparse subroutine automatically placed the contents of of the HTML form in an array called value. This makes it easy, because the contents of the first text box is in $value[0]. The second is in $value[1], the third is in $value[2]. Remember, Arrays always start counting with 0.
In the second line we executed this command:
$firstname = $value[0];
This line creates a new variable called $firstname, and assigns the
contents of $value[0] to it. This means that $firstname now
contains the value was typed in the first textbox on the HTML form.
The third and fourth lines are almost identical,
$lastname =
$value[1];
$email = $value[2];
Obviously, these two lines assign the contents of the second and third text
boxes to $lastname and $email respectively.
The last 3 lines of the program print both text and variables to the screen.
print "Your first name is
$firstname<BR>";
print "Your last name is $lastname<BR>";
print "Your e-mail is
$email<BR>";
Notice that the variable is contained entirely within the doublequotes. In other languages, such as JavaScript, we would have had to concatonate the text and variables together. When Perl sees the $ symbol, however, it simply substitutes the contents of the variable. Nice feature, isn't it? Note: This is only true for double quotes. Single quotes take their contents literally.