It can be challenging to try and debug a Perl script using a web browser. For instance, file permissions, a syntax problem, or something else entirely could be the reason of a "Internal Server Error" message. By login into your SSH account and running the script from the command line, you can get a lot more helpful information about script failures. To do this, type the following the command, replacing filename with the script filename:
perl filename
When there is an error, the Perl interpreter outputs detailed information about the type of error, and often the exact line number in the script file where the error occurred.
If you need even more detailed information or control over the script's execution, you can run the script in the Perl command-line debugger. To do this, type the following command:
perl -d filename