If you place the script in the cgi-bin directory,
1. Permissions set to 0755
2. #! /usr/bin/perl the first line
3. Uploaded in ASCII mode, not binary, especially if you are working from a Windows machine
4. If you use Notepad++ make sure that the encoding does not have a BOM
5. print...