@ARGV not working

R

Ray

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
 
W

wana

Ray said:
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
 
A

A. Sinan Unur

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

Arndt Jonasson

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.)
 
T

Ting Wang

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top