biochris has asked for the wisdom of the Perl Monks concerning the following question:

I try to run a logon perl script on RedHat Workstation 3. When I run a ps -ef I see my script as /usr/bin/perl -w? script_name Anyone knows why I get the question mark after the -w switch? Thank you

Replies are listed 'Best First'.
Re: /usr/bin/perl -w?
by ysth (Canon) on Jun 20, 2005 at 20:33 UTC
    Just at a guess, your script has a CR at the end of the shebang line?
      Thank you so much :)
Re: /usr/bin/perl -w?
by chas (Priest) on Jun 20, 2005 at 21:14 UTC
    And with regard to ysth's reply, I once noted that if my shebang line was #!/usr/bin/perl followed by a carriage return (due to editing the script on a Windows machine and then transferring to Linux), the script exited with an error that the command was not found. (Putting -w at the end of the line fixed the problem, because then the carriage return was ignored as an unknown option, I think.) You can check if the return is there by editing the script in binary mode with vi(m) or emacs, etc.
        Some people take the approach of creating a "/usr/bin/perl\r" link to /usr/bin/perl :)

        And Unix commands in general, too! Because of shell design and such, typing rm * in a directory which contains a file named -rf could delete everything (except the file -rf)! You should do rm -- * instead. I have actually been bitten by this once or twice, but luckily not by -rf but something more mundane.

      Looks like it worked. thanks so much
Re: /usr/bin/perl -w?
by aditya.singh (Acolyte) on Jun 22, 2005 at 09:36 UTC
    Check you shebang(#!) line. You probably have ^M or some other unprintable character there.
      Yep, that was the problem. Thanks