in reply to ENV(SERVER_URL) is NULL

Check the server logs

See CGI Help Guide , Troubleshooting Perl CGI scripts,, and other CGI Programming Tutorials