刚安装的apache,这段代码太厉害了,高手解析下源码

刚安装的apache,这段代码太厉害了,高手解析下源码

#!c:/Perl/bin/perl.exe
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n"



在网页里执行后的结果
COMSPEC="C:\WINDOWS\system32\cmd.exe"
DOCUMENT_ROOT="D:/httpd/htdocs"
GATEWAY_INTERFACE="CGI/1.1"
HTTP_ACCEPT="application/x-shockwave-flash, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-silverlight, */*"
HTTP_ACCEPT_ENCODING="gzip, deflate"
HTTP_ACCEPT_LANGUAGE="zh-cn"
HTTP_CONNECTION="Keep-Alive"
HTTP_HOST="127.0.0.1:8080"
HTTP_USER_AGENT="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; CIBA)"
PATH="C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem"
PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH"
QUERY_STRING=""
REMOTE_ADDR="127.0.0.1"
REMOTE_PORT="4212"
REQUEST_METHOD="GET"
REQUEST_URI="/cgi-bin/state.cgi"
SCRIPT_FILENAME="D:/httpd/cgi-bin/state.cgi"
SCRIPT_NAME="/cgi-bin/state.cgi"
SERVER_ADDR="127.0.0.1"
SERVER_ADMIN="local@local.com"
SERVER_NAME="127.0.0.1"
SERVER_PORT="8080"
SERVER_PROTOCOL="HTTP/1.1"
SERVER_SIGNATURE=""
SERVER_SOFTWARE="Apache/2.2.10 (Win32)"
SYSTEMROOT="C:\WINDOWS"
WINDIR="C:\WINDOWS"
没有看懂你的意思。。
不就是print %ENV 啊