@ARGV not working

Discussion in 'Perl Misc' started by Ray, Oct 25, 2004.

  1. Ray

    Ray Guest

    For some reason, @argv doesn't work on my machine, but when I run the
    script on a coworker's machine (which has the same NT build as I do it
    works).

    Example:

    When I type at the command line: perl test.pl foo
    I don't get any output. No error messages, nothing. When I run the
    script on another machine it works as expected. Here's the code
    snippet I'm using:


    print @INC;
    print @ARGV;


    The first print statement works as expected, but the @ARGV doesn't.

    Any ideas?

    Thanks
     
    Ray, Oct 25, 2004
    #1
    1. Advertising

  2. Ray

    wana Guest

    Ray wrote:

    > For some reason, @argv doesn't work on my machine, but when I run the
    > script on a coworker's machine (which has the same NT build as I do it
    > works).
    >
    > Example:
    >
    > When I type at the command line: perl test.pl foo
    > I don't get any output. No error messages, nothing. When I run the
    > script on another machine it works as expected. Here's the code
    > snippet I'm using:
    >
    >
    > print @INC;
    > print @ARGV;
    >
    >
    > The first print statement works as expected, but the @ARGV doesn't.
    >
    > Any ideas?
    >
    > Thanks


    It worked for me:

    perl -e 'print @ARGV' 'it ' 'works'

    output: it works

    wana
     
    wana, Oct 25, 2004
    #2
    1. Advertising

  3. wana <> wrote in news::

    > Ray wrote:
    >
    >> For some reason, @argv doesn't work on my machine, but when I run the


    You are positive that you did not misspell @ARGV in your script?

    > It worked for me:
    >
    > perl -e 'print @ARGV' 'it ' 'works'


    If you are using cmd.exe, you might want to change that to:

    C:\Home> perl -e"print qq{@ARGV}" it works
    it works

    Sinan
     
    A. Sinan Unur, Oct 25, 2004
    #3
  4. (Ray) writes:
    > For some reason, @argv doesn't work on my machine, but when I run the
    > script on a coworker's machine (which has the same NT build as I do it
    > works).
    >
    > Example:
    >
    > When I type at the command line: perl test.pl foo
    > I don't get any output. No error messages, nothing. When I run the
    > script on another machine it works as expected. Here's the code
    > snippet I'm using:
    >
    >
    > print @INC;
    > print @ARGV;
    >
    >
    > The first print statement works as expected, but the @ARGV doesn't.
    >
    > Any ideas?


    I get the bad behaviour on Solaris (Perl 5.005) as well.

    I suggest outputting a "\n" as well:

    print @INC;
    print @ARGV;
    print "\n";

    I don't know why this should behave differently on two machines of the
    same kind, but maybe there are timing considerations (speculating wildly).
    (So why does @INC get printed? Maybe because it's much longer than @ARGV.)
     
    Arndt Jonasson, Oct 26, 2004
    #4
  5. Ray

    Ting Wang Guest

    >I get the bad behaviour on Solaris (Perl 5.005) as well.
    I do not get the bad behaviour on Solaris 2.8 (Perl 5.005).
    print @ARGV;
    works as expected
     
    Ting Wang, Oct 26, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bret

    char **argv vs. char* argv[]

    Bret, Aug 31, 2003, in forum: C Programming
    Replies:
    21
    Views:
    4,697
    Richard Heathfield
    Sep 3, 2003
  2. David
    Replies:
    10
    Views:
    6,072
    Richard Heathfield
    Sep 15, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,709
    Old Wolf
    Jan 20, 2004
  4. =?ISO-8859-1?Q?Thomas_N=FCcker?=

    sys.argv[0] - 'module' object has no attribute 'argv'

    =?ISO-8859-1?Q?Thomas_N=FCcker?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    1,000
    =?ISO-8859-1?Q?Thomas_N=FCcker?=
    Jun 30, 2003
  5. jab3

    char **argv & char *argv[]

    jab3, Dec 4, 2004, in forum: C Programming
    Replies:
    5
    Views:
    720
    Chris Torek
    Dec 8, 2004
Loading...

Share This Page