歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> 關於Unix

利用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 "tabl
  #!/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;

Copyright © Linux教程網 All Rights Reserved