N
Niall Macpherson
I've recently returned to using perl after a year or so away.
I inherited a script which was using Getopt::Std but when I ran it I
couldn't seem to pick up the command line args correctly. I looked at
ARGV[] and this was showing empty.
I therefore just tried running the following
use strict;
use warnings;
print "arg0=" , $ARGV[0], "\n", "arg1=", $ARGV[1], "\n";
No matter what I pass on the command line, single quoted , double
quoted or unquoted I never get anything in $ARGV[0] or $ARGV[1].
U:\PerlScripts>argv.pl "aaaaa" "ddddd"
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg0=
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg1=
The only command I can get to work is as follows
U:\PerlScripts>perl -le "print $ARGV[0]" "dddddddddd"
dddddddddd
U:\PerlScripts>
Having been away from perl for some time I guess I'm missing something
fundamental here. Perl is ActiveState 5.8.3
I inherited a script which was using Getopt::Std but when I ran it I
couldn't seem to pick up the command line args correctly. I looked at
ARGV[] and this was showing empty.
I therefore just tried running the following
use strict;
use warnings;
print "arg0=" , $ARGV[0], "\n", "arg1=", $ARGV[1], "\n";
No matter what I pass on the command line, single quoted , double
quoted or unquoted I never get anything in $ARGV[0] or $ARGV[1].
U:\PerlScripts>argv.pl "aaaaa" "ddddd"
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg0=
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg1=
The only command I can get to work is as follows
U:\PerlScripts>perl -le "print $ARGV[0]" "dddddddddd"
dddddddddd
U:\PerlScripts>
Having been away from perl for some time I guess I'm missing something
fundamental here. Perl is ActiveState 5.8.3