This is very bad in the world of CGI, especially where PERL is concerned. Some text editors have a Save as Unix text or Convert to Unix text option. Use this option to ensure that your scripts will be in a format that Unix understands. This is only a precautionary step. Your FTP program should support different modes of transferring files.
Binary mode is for transferring non-text things, such as .jpg or .gif images.
Hail the fromdos command. It's simple to use. Using the above example, badfilename.cgi is the infested file, and newfilename.cgi will be the sanitized version. If possible, you should try to test your CGI on your own machine before you try it from a web page. If something goes wrong with your script, it can, for example, get stuck in an endless loop and comsume much of the server resources.