in reply to perl $ENV question
That's because environment variable REQUEST_METHOD isn't defined. You can define it in your shell, or just add a check:
if ($ENV{REQUEST_METHOD} and $ENV{'REQUEST_METHOD'} eq 'POST') { [download]