Web >> Development >> CGI >> Perl >>  How to extract server environment using Perl

#! perl print "Content-type: text/html\n\n"; print qq(<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><body>); foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\n|g; $val =~ s|"|\"|g; print "${var}=\"${val}\"<br>\n"; } print qq(</body></html>);