
1arryb
User
Sep 9, 2010, 6:38 AM
Post #4 of 4
(6618 views)
|
Re: [skotagi] String comparison help
[In reply to]
|
Can't Post
|
|
Hi skotagi, Like all Perl arrays, @ARGV will return the number of elements if you call it in scalar context. Consider this little script:
my $nArgs = @ARGV; print ("nArgs=$nArgs, ARGV=", join(', ', @ARGV), "\n"); Save that to a file called tmp.pl and run it with some arguments:
# perl tmp.pl Huey Dooey Looey nArgs=3, ARGV=Huey, Dooey, Looey # So, we don't really know what the value of @ARGV is; except that there appears to be more than one argument. Why don't you add some instrumentation at the top of your program to print it out?
print "DEBUG: ARGV:\n"; for (my $i = 0; $i < scalar(@ARGV); $i++) { print(" ARGV[$i] = \"$ARGV[$i]\"\n"); } Once you understand what input your program is getting (I'm kind of getting that you aren't typing it yourself on a command line, right?), you will be in a better position to parse it. Cheers, Larry
|