Command line arguments are passed to the script in the array '@ARGV', not
'@_'. '@_' is used for subroutines.
-----Original Message-----
From: Bob Bondi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 12:51 PM
To: [EMAIL PROTECTED]
Subject: Help: Starting a script with command line arguments
My question is: how can I pass arguments to a script from the command line?
The script at the tail of this message is what I thought would print the 2
arguments I passed into the script, yet the output for this snippet is:
Here ya go:
Here ya go:
Count is: 0
Not enough arguments to get started
#\perl\bin
use strict; # use strict! It will save you many headaches
use File::Basename;
use Carp;
my $count = @_;
print "Here ya go: $_[0]\n";
print "Here ya go: $_[1]\n";
print "Count is: $count\n";
carp "Not enough arguments to get started" unless $count > 0;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]