Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Perl >> Snippet

CGI script to display all environmental variables


foreach $key ( sort keys ( %ENV ))
  { print "$key=$ENV{$key}<p>" ; }

Environmental Variables are contained in %ENV , an associate array:

CONTENT_LENGTH       length in bytes of the input stream
CONTENT_TYPE        Content type of the data passed with the query
DATE_LOCAL          Current local data and time
LAST_MODIFIED       Date and time of the last modification of the current document
DOCUMENT_ROOT       Directory over which all www document paths are resolved by the server
HTTP_REFERER        URL that referred the web client to the script
HTTP_USER_AGENT     Name / version of the client (browser) issuing the request to the script
PATH_INFO           The extra path information following the script 's path in the URL
PATH_TRANSLATED     The PATH_INFO mapped onto DOCUMENT_ROOT
QUERY_STRING        Query information, following a question mark after the script location
REMOVE_ADDR         IP address from which the client is issuing the request
REMOTE_HOST         Name of the host form which the client issues the request
REQUEST_METHOD      GET, POST, or HEAD
SCRIPT_NAME         The virtual path from which the script is executed
SERVER_NAME         The web server 's hostname or IP address
SERVER_PORT         The web server 's listening port
SERVER_SOFTWARE     Name / version of the information server software answering the request