当前位置:Linux教程 - Linux资讯 - 利用Perl列出系统环境变量清单范例

利用Perl列出系统环境变量清单范例

  #!/usr/bin/perl   #安装说明:   #复制程序代码,并存成env.cgi   #以ascii模式上传至主机cgi-bin目录后将属性改成755   $=1;   print "Content-type: text/Html\n\n";   print "<html><head><title>环境变量清单</title>\n";   print "</head>\n";   print "<body>\n";   print "<table border=1>\n";   print "<tr>\n";   print "<td>变量名称</td>\n";   print "<td>目前状况</td>\n";   print "</tr>\n";   foreach $fieldname(keys %ENV){   print "<tr>\n";   print "<td>$fieldname</td>\n";   print "<td>$ENV{$fieldname}</td>\n";   print "</tr>\n\n";   }   print "</table>\n";   print "</body></html>\n";   exit;

(出处:http://www.sheup.com)