You would change to:

$firstvar = shift(@ARGV);
$secondvar = shift(@ARGV);
   or
        my ($firstvar ,$secondvar) = @ARGV;     

        Then you could test if anything passed:

        if ( ! defined $firstvar ) {
           $firstvar = 'Nothing passed';
           $secondvar = 'Nothing passed';       
       }elsif ( ! defined $secondvar ) {
           $secondvar = 'Nothing passed';       
       }

Wags ;)
-----Original Message-----
From: Mike Gargiullo [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 26, 2001 09:58
To: [EMAIL PROTECTED]
Subject: command line args


How do I pass and use arguments into the command line?
 
such as;
> myprogram var1 var2
 
where the program would read as follows
 
#!/usr/bin/perl -w
$firstvar = shift(@args);
$secondvar = shift(@args);
print STDOUT "$firstvar";
************************************************************************
*************
Michael Gargiullo
VP of IT
Infinity Adventures, Inc.
231 Clarksville Rd.
Princeton Jct. NJ 08550
 
800-667-1855
609-897-0006 - fax
 
[EMAIL PROTECTED]
www.infinityadventures.com <http://www.infinityadventures.com/> 
 
************************************************************************
*************
The information contained in this e-mail message may be privileged,
confidential, and protected from disclosure. If you are not the intended
recipient, any further disclosure or use, dissemination, distribution,
or copying of this message or any attachment is strictly prohibited. If
you think that you have received this e-mail message in error, please
delete it and notify the sender.

 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to