Breaking down the code,
an introduction to Perl.
#!/usr/local/bin/perl
#
&readparse;
print "Content-type: text/html\n\n";
#*****************BEGIN BODY*************
The first line of every CGI in Unix is the path to the program which
will run
it. Remember, yours may be different because you substitued the path
to Perl on your machine. The server will follow that path, locate Perl,
and then use the Perl interpreter to execute the program. This is
the only line which begins with a hash mark (#) and has some meaning to
the program. Throughout the remainder of the program, the # symbol
is a comment, and the program will disregard anything which follows
it.
The third line is one command, &readparse; .
This calls a subroutine (like executing a function in JavaScript) located
down below the body, which imports all of the text entered in the HTML
form.
The fourth line is required for all CGI programs. It tells the
server that anything we choose to print should be returned as an HTML document.
These lines will never change, so from now on we will only focus on
the contents of the BODY section.
|