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


in reply to script times out mysteriously

I just moved a bunch of Perl scripts over to a server that I control. First, all of my scripts now require the -w switch in order to run. .. I'd like to know how I can turn off the -w switch and have the script still run.

If you're FTPing the files from a Windows box to a *nix server in binary mode, carriage returns in the files are retained (ASCII mode removes the carriage returns). The effect of leaving carriage returns in the file is that the shebang line now reads

#!/usr/bin/perl -w^M
Depending on how you view the file, you might not see the ^M. With the -w there, this is O.K., but if you remove it and then FTP the file again, you'll get
#!/usr/bin/perl^M
which no longer names a valid executable file. You try to bring the file up through a web server, and you'll get a 500.

Try FTPing in ascii mode.