in reply to Processing ARGV

The errors you're getting sound like you're actually running the program through a shell rather than perl. What happens when you type perl testARGV.pl?

Replies are listed 'Best First'.
Re^2: Processing ARGV
by kmullin (Acolyte) on Dec 05, 2007 at 18:14 UTC

    Interesting. When I run:

    perl testARGV.pl 1 2 3 4 5

    then I get

    Start of testARGV.pl

    and thats it! the error messages are gone, but where are the values I am trying to print? And I have the shebang in my code specifying

    #!/opt/third/party/bin/perl -w

    and I've verified that it does exists. (Its even in my PATH). When I do:

    /opt/third-party/bin/perl -v

    I see

    This is perl, v5.6.0 built for Linux-2.4c2.3-i686 Copyright 1987-2000, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5.0 source +kit. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge.

    Any more comments? Why don't I get my command line arguments.

      At the risk of pointing out the obvious, or a typo on your part, the path you give for printing the perl version is not the same path you have in your shebang line. Specifically 'third/party' ne 'third-party'.
      You may want to try
      perl -e 'print $_, $/ for @ARGV' 1 2 3 4 5 #which prints #1 #2 #3 #4 #5
      in order to assure yourself that perl has been installed correctly.
      And of course - see what `which perl` returns in case that the script works fine.


        I'm told that with a bad shebang, it uses /bin/sh, which is the ksh around here, so that explains that.

        I now have my code working. Thanks for your help.

      Odd. It works fine for me.
      $ perl testARGV.pl 1 2 3 Start of testARGV.pl 123