用perl写cgi的程序,有时需要读取环境变量,可是又不知道那些变量是有的,下面的小程序可以帮忙。
Code1
#!/usr/bin/perl
print "Content-type: text/html\n\n"; print "\n" ;
foreach $key (sort keys(%ENV)) { print "$key = $ENV{$key}" ; }
|
Code2
#!/usr/bin/perl
print "Content-type: text/html\n\n"; print "\n" ;
print ("$_ = $ENV{$_}" ) foreach (sort keys %ENV);
|
Code3
#!/usr/bin/perl
print "Content-type: text/html\n\n"; print "\n" ;
while (($key,$value) = each(%ENV)){ print "$key = $value" ; }
|
阅读(1299) | 评论(0) | 转发(0) |