Re: Argument for perl script

2008-06-19 Thread Nayab
On Jun 19, 4:55 pm, [EMAIL PROTECTED] (Rajnikant) wrote: > Hope this snipet will help you :). > > # Use :Perl -w test_argc.pl --name Irfan > > use strict; > use warnings; > > # Get args > my @argv = @ARGV; > > #get args cnt > my $argc = @ARGV; > > my $icnt = 0; > > if($argc != 0) > { >     for($icn

RE: Argument for perl script

2008-06-19 Thread Irfan.Sayed
Thanks a lot for all response. Regards Irfan. -Original Message- From: Mimi Cafe [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2008 6:34 PM To: beginners@perl.org Subject: Re: Argument for perl script You may have to parse @ARGV manually depending on how arguments are passed to

Re: Argument for perl script

2008-06-19 Thread Mimi Cafe
You may have to parse @ARGV manually depending on how arguments are passed to your script. For instance, if you script is run as follows: perl ack --name foo --pkg bar -relno 1234 then @ARGV will contain "--name, foo, --pkg, bar, -relno, 1234," and you will have to parse the list for the values you

RE: Argument for perl script

2008-06-19 Thread Rajnikant
Hope this snipet will help you :). # Use :Perl -w test_argc.pl --name Irfan use strict; use warnings; # Get args my @argv = @ARGV; #get args cnt my $argc = @ARGV; my $icnt = 0; if($argc != 0) { for($icnt = 0;$icnt < $argc;$icnt++) { if($argv[$icnt] eq "--name") {