in reply to Re^5: Perl Script in Windows Works, but not in Unix
in thread Perl Script in Windows Works, but not in Unix

I think we're on the right track with the invocation too. For example, when I use the path /usr/bin/perl, I now get the error #: bad interpreter: No such file or directory. When using path /usr/bin/env perl I get error env: perl\r: No such file or directory. Looking in the bin folder I see I have a file called "env" and a file called "perl".

Replies are listed 'Best First'.
Re^7: Perl Script in Windows Works, but not in Unix
by stevieb (Canon) on Jun 26, 2015 at 20:03 UTC

    That's might be a line ending issue. When I create a script on Unix, I can run it on both Windows and Unix, however if I create it on Windows, it won't run on *nix. If you're having problems running a script created on Windows on your Unix boxes, here's a quick fix for you... open the script in vi: vi script.pl, and immediately type the following after it opens(include the colon):

    :set ff=unix

    ...then hit ENTER, then type :wq and ENTER again. That'll set your line endings to use Unix style endings and will (should) work on both platforms.

    -stevieb

Re^7: Perl Script in Windows Works, but not in Unix
by mr_mischief (Monsignor) on Jun 26, 2015 at 20:07 UTC

    You shouldn't have \r anywhere in a text file on Linux or Unix. Try dos2unix or, failing that, use:

    perl -i~ -pe 'tr/\r//d; print' filename
    to get rid of stray carriage returns.