Perl scripts often reside on a server
and
may be called into action via submission of a form from a web page
.
In its most common usage, a Perl script responds to the request from a form
and
creates a web page (text file
that is formatted to HTML standards) that is returned to the requestor
-
dynamic page generation
.
Here
's a sample calling HTML page, which has a form with a single submit button that sends a
request to the server to run the Perl script called decide
.
pl
.
<
html
><
head
></
head
><
body
>
<
h2
>
Decide
</
h2
>
<
form action
=
"/cgi-bin/decide.pl"
method
=
"get"
><
input type
=
"submit"
value
=
"decide"
></
form
>
<
/body</html
>
In general, the output of the Perl program (via the
print
statement) is fed to the HTTP server, which
in turns sends it back to the requestor
.
The first line of the script provides the only HTTP header
information needed
for
the browser to correctl interpret the output of the script as an HTML page
.