Well, once you upload your .cgi script to your webhost, you have to do two things:
A. Modify the files permissions to 0755, preferably using an FTP program.
B. At the very top of the script, before anything else (excluding the shebang), you have to put this line:
print "Content-type: text/html\n\n";
Then it should work perfectly, also make sure that the shebang is pointing at the Perl interpreter on your
server's system. Common mistake to accidently make it point tword your own. I do it sometimes.