Server Environment Variables

One of the methods that the web server uses to pass information to a cgi script is through environmental variables. These are created and assigned appropriate values within the environment that the server spawns for the cgi script. They can be accessed as any other environmental variable, like with %ENV{'VARIABLE_NAME'} (in Perl). Many of them, contain important information, that most cgi programs need to take into account.

To get a list of such environment variables, use the below script:

#!/usr/bin/perl
foreach $value(keys %ENV) {
  print "$value: $ENV{$value}\n";
}
exit;
Comment