Debugging CGI and Perl Scripts One of the easiest ways to determine the exact error within your Perl script is to add the following line as line #2 in your .cgi file. use CGI::Carp (fatalsToBrowser); This will output any error messages to your web browser, allowing you to modify those errors and re-run the program.