Madhu Reddy wrote: > Hi, > I want to pass command line arguements to perl > program ? > How to do this ? >
Perl stores args passed to your script at @ARGV. you could check what's there by looking at this array like: #!/usr/bin/perl -w use strict; #-- #-- cat.pl #-- while(@ARGV){ print shift,"\n"; } __END__ [panda]$ cat.pl fish water fish water Or (perfer method) you could use Getopt::Std like: #!/usr/bin/perl -w use strict; #-- #-- args.pl #-- use Getopt::Std; getopts('a:b:c:d',\my %args); print "-a: $args{a}\n"; print "-b: $args{b}\n"; print "-c: $args{c}\n"; print "there is a -d as well\n" if($args{d}); __END__ [panda]$ args.pl -a abcd -b 1234 -dc xxxx -a: abcd -b: 1234 -c: xxxx there is a -d as well Getopt is simple and very easy to use and i recommnd you learn and use it. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]