Perl execution error

Hello all,

I know this is probably my fault, but I cannot get any Perl script to work. Even simple scripts, I have also taken some from these forums and still getting errors. The browser returns:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

the error log says:

Premature end of script headers
along with other errors.

I have chmodded the files to 755 and the directories are automatically 755. Can anyone help or give me an answer as to why this is happening?

I’ve not tried running Perl scripts on a website, but wouldn’t it require a handler in .htaccess to run?

AddHandler cgi-script .cgi .pl

Most common cause of this type of issue is that your Perl script is missing the #!/usr/bin/perl header, or is saved with Windows line endings. If all else fails, try running the script from a shell and see what happens.

I’ve hosted the page on my own server and it runs perfectly, this is a windows server though. I’ll try rewriting a script on a linux machine and see if this changes anything. Is there any other reasons that anyone can think of?

Just to let everyone know it was the issue with the line endings.

Thanks for the help.