Users should place .cgi, .pl, or .py programs into their public_html/cgi-bin directory.

The correct hash bang line to include for perl is:
The correct has bang line to include for python is:

You should also be aware that the file permissions need to be set so that the files are readable and executable as follows: chmod 755 something.cgi
If the permissions on the file are incorrect you will probably receive an "Internal Server Error" message when trying to access the script.

Example permissions may look like the following:
-rwxr-xr-x public_html/cgi-bin/test.cgi