#!/usr/local/bin/perl # script: printenv.pl &print_HTTP_header; &print_head; &print_body; &print_tail; # print the HTTP Content-type header sub print_HTTP_header { print "Content-type: text/html\n\n"; } # Print the HTML preamble sub print_head { print < Environment Variables

Environment Variables:

END ; } # Loop through the environment variable # associative array and print out its values. sub print_body { foreach $variable (sort keys %ENV) { print "$variable: $ENV{$variable}
\n"; } } # Print the end of the document sub print_tail { print < END ; }