http://www.perlmonks.org?node_id=454741


in reply to Perl CGI gives HTTP error 500

The reason is that Windows defines a line ending as a CR and a LF (CR/LF) and Unix defines a line ending as just an LF.

When you transfer the file from Windows to the unix box, if you open it in vi on the unix box, you'll notice that each line ends with a ^M character. This is the CR/LF.

If you don't want to mess around with your Windows editor settings, you can use the following unix command. It works without fail for me:

tr -d '\r' <inputfile> outputfile

What that does is remove the Carriage Return (CR) character.

If you give a man a fish he will eat for a day.
If you teach a man to fish he will buy an ugly hat.
If you talk about fish to a starving man, you're a consultant.