next up previous contents index
Next: Standard Input Up: CGI Scripting Previous: CGI Scripting   Contents   Index


Every program has an environment in which it runs. In Perl the environment is stored in a hash variable called %ENV. In order to print the environment from a CGI program you could create the following perl CGI program env.cgi:


print "Content-type: text/html\n\n";

print "<html>\n";
print "<head>\n";
print "<title>Environment</title>\n";
print "</head>\n";
print "<body bgcolor=ffffff>\n";

print "<h1>Environment</h1>\n";
foreach $x (keys(%ENV)) {print "$x=$ENV{$x}<br>\n";}

print "</body>\n";
print "</html>\n";


You could then run the program and see the environment that the program runs in.

Joseph Colton 2002-09-24