Kaye and Geoff's web page documentation 

Perl script: information passed via environment variable QUERY_STRING

The following Perl code returns a web page containing the information which was passed by a query string at the end of the URL.

#! /usr/bin/perl # # receives information from the QUERY_STRING environment variable # uses the information to choose the required option # print "Content-type: text/html\n\n"; print '<html><head><title>Information passing via an environment variable</title></head>'; print '<body bgcolor="#ffffff">'; print '<pre>'; print "\n\n"; if ($ENV{QUERY_STRING} eq 'odd') { print "1 3 5 7 9 \n"; } else { print "2 4 6 8 \n"; } print '</pre>'; print '</body></html>'; exit;
Top
Close