have a look at the use Getopt::Long; module, it handles this pretty nicely.
 
example:
 
use Getopt::Long;
 
&GetOptions("source=s" => \$sourcedir,"help" => \$help);
 
if($help){
  print "commandline parameters:\n";
  print "  -help           : this help\n";
  print "  -source <dir>   : source dir\n"; 
  exit;
}
 
then you casn call your script with: scriptname.pl -source /some/path
----- Original Message -----
Sent: Wednesday, September 11, 2002 11:44 AM
Subject: [Perl-unix-users] Command line arguments?

Thankyou for all of your suggestions regarding copying a file.
One more question : Is it possible to pass command line arguments while executing a perl program? In other words, can I pass a number as argument along with calling the program, instead of asking the user to input the number at the user prompt.

Thanks & Regards
Ann Thomas
ESG SaLes Incentive Comp. IT
Tel : (+65)-6374-1841
HP Telnet: 834-1841

 

 

Reply via email to