This may be a good point to introduce the module Data::Dumper.

This module is one of the most useful modules for this kind of debug.

Code: PERL
use Data::Dumper;
print "Content-type: text/html\n\n";
print "<html><head/><body><pre>\n";

print Dumper(\%ENV);

print "</pre></body></html>\n";

Note: I'm not working in the internet environment so some errors can appear on my code, but the idea is there ;)