in reply to Why does Perl choke on \015 ^M chars

If there is a ^M at the end of the first line, your shell is trying to run a program called /usr/bin/perl^M which doesn't exist. This problem seems to go away if you use -w (or some other argument) on the shebang line, as the shell can then find the /usr/bin/perl in #!/usr/bin/perl -w^M.

Replies are listed 'Best First'.
Re: Re: Why does Perl choke on \015 ^M chars
by liz (Monsignor) on Jan 03, 2004 at 09:56 UTC
    An alternate solution, which I have taken when I was still doing sysadmin chores for an ISP in the past, was to create a symbolic link from /usr/bin/perl^M to /usr/bin/perl (and the same for /usr/local, actually). This made sure that whenever someone uploaded a script in binary mode from a Windows machine, that the script would work without further human meddling from either end.

    Liz

Re: Re: Why does Perl choke on \015 ^M chars
by tachyon (Chancellor) on Jan 03, 2004 at 04:30 UTC

    Of course, that makes perfect sense. I must have more scripts with no -w than I thought ;-)

    cheers

    tachyon