in reply to /usr/bin/perl^M: bad interpreter:

If you end you shebang with " --", you don't have to worry about that
#!/usr/bin/perl --

Replies are listed 'Best First'.
Re^2: /usr/bin/perl^M: bad interpreter:
by JavaFan (Canon) on Dec 03, 2009 at 08:59 UTC
    #!/usr/bin/perl -- works for me, but #!/usr/bin/perl ^M -- doesn't.

    On what OS does -- tell the kernel to chop off a character from the path following the #!?

      Isn't the point that if the original shebang (on *nix) is:

      #!/usr/bin/perl --

      And the file gets downloaded to win in binmode it will become:

      #!/usr/bin/perl --^M

      And the ^M will then be ignored!


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      '--' isn't used to 'chop off' any characters - when used, as BrowserUk implied earlier, it flags the end of the CLI option list to the script/executable and thus whatever follows (in this case the ^M) is/are arguments to the script/executable.

      The 'classic' usage is when grep'ping for a string containing dash(es) &/or minus(es) e.g. grep -- this-string some_file - which tells grep that 'this-string' is a string and not a malformed CLI option.

      A user level that continues to overstate my experience :-))