#!/usr/bin/perl
# This script outputs the environment variables.
# create the http header
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html\n";
$header .= "\n";
# initalize the html output
$html = "\n";
$html .= "
\n";
$html .= "\n";
$html .= "Environment variables\n";
$html .= "\n";
$html .= "\n";
$html .= "\n";
my @temp = keys %ENV;
$html .= "Environment variables\n";
$html .= "\n";
foreach (@temp) {
$html .= "- " . $_ . " = " . $ENV{$_} . "
";
}
#$html .= "@temp";
$html .= "
\n";
# add a cute line demonstrating the use of one such variable
$html .= "Hello there, $ENV{REMOTE_HOST} It's nice to meet you!\n";
# finish the html
$html .= "\n";
$html .= "\n";
# output the header and html content
print "$header$html";
# exit gracefully
exit;