in reply to Perl Script only runs with -w switch

I'm going nutz trying to figure out what the problem is.

And we'll go nuts trying to read your mind. Give us more info. Try working up a small example that demonstrates the problem, and post the code. To get small, take a script that's failing, and remove as much as you can.

Here's a wild guess: You FTP'd the scripts from your FreeBSD system to a Win32 box, then FTP'd them to the RedHat server. Along the way, the scripts picked up Win32 line endings (\r\n), which you neglected to removed as you moved the files to RedHat (i.e., by transfering in binary mode). This would leave you with shebang lines that either look like:   #!/usr/bin/perl -w\r which works, or   #!/usr/bin/perl\r which doesn't, because the OS is unable to locate an executable named "/usr/bin/perl\r".

Replies are listed 'Best First'.
Re: Re: Perl Script only runs with -w switch
by NailBombJoe (Novice) on Nov 21, 2002 at 20:16 UTC
    You guessed right about how I transfered the script, although I used SSH. I don't see a \r or \n on the first line when I view the script with vi which I am guessing means I wouldn't be able to see them after the file goes through this transfer process. What would be the best way to fix this problem? Joseph Wagner Network Manager
      I don't see a \r or \n on the first line when I view the script with vi

      What about a ^M ?

      -Nitrox

        Nope. I don't see a \r \m or ^M. Joseph Wagner Network Manager