That means the file needs to be stripped of the '\r's. You can do it as I mentioned above or you download a "dos2unix" script from the net (it does basically the same thing I showed you with the "tr" command above).
The first line in the script "#!/usr/bin/perl" *must* end with a '\n' only, not a '\r\n'.
Another easy way to convert it to UNIX format is to open the file in vim. If you do a ":w" it will write the file and if it shows "[dos]" on the bottom line it is in DOS format and will fail with the error message you posted. You can convert it to UNIX (strip the carriage returns) right in vim by doing a ":set fileformat=unix" then type ":w" and it should write the file without the carriage returns and not display a "[dos]" on the bottom line. It should then run properly.
Another way to check if there is a carriage return on the first line is do this (replace "script.cgi" with the name of the Perl CGI file you want to check):
head -1 script.cgi | od -c -w18
which should produce this:
If it has a carriage return it will look like this:
The first example is UNIX format, the second is DOS format.
[ July 26, 2002: Message edited by: VoidMain ]