Parag Kalra wrote:
use Getopt::Long;
my ( $name, $passion, $age);
my $result = GetOptions(
'name|n=s' => \$name,
'passion|p=s' => \$passion,
'age|a=i' => \$age,
);
I prefer the hashref mode:
#!/usr/bin/perl -wl
use strict;
use Data::Dump
Parag Kalra wrote:
> use strict;
> use warnings;
The above should *always* be present in *every* Perl script, even when
you think you are writing a script to test something only once.
> use Getopt::Long;
>
> my ( $name, $passion, $age);
>
> my $result = GetOptions(
>'name|n=s'
Thank you folks. This is more than what I wanted. Here is my version of the
same : ;)
use strict;
use warnings;
use Getopt::Long;
my ( $name, $passion, $age);
my $result = GetOptions(
'name|n=s' => \$name,
'passion|p=s' => \$passion,
'age|a=i' => \$
Owen wrote:
>> Hello All,
>>
>> This is surely a beginner's question and may even sound silly. :)
>>
>> How do you make a Perl script skip an input parameter if it is not
>> present.
>> Let me explain it through an example.
>>
>> EG:
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> no warnings
At 2:09 AM +0530 1/10/10, Parag Kalra wrote:
Hmmm.
Although its sufficing my needs but I wanted a way to pass an undef. May be
I will have make it undef manually if an input parameter is an empty string
or something like that.
The "normal" way to set a variable as undef using command-line
arg
> Hello All,
>
> This is surely a beginner's question and may even sound silly. :)
>
> How do you make a Perl script skip an input parameter if it is not
> present.
> Let me explain it through an example.
>
> EG:
> #!/usr/bin/perl
> use strict;
> use warnings;
> no warnings 'uninitialized';
> prin
Hmmm.
Although its sufficing my needs but I wanted a way to pass an undef. May be
I will have make it undef manually if an input parameter is an empty string
or something like that.
Anyway thanks. :)
Cheers,
Parag
On Sun, Jan 10, 2010 at 1:49 AM, Shlomi Fish wrote:
> Hi Parag!
>
> On Satur
Hi Parag!
On Saturday 09 Jan 2010 22:04:40 Parag Kalra wrote:
> Or let me put it this way - How can we pass an input parameter as an undef
>
You can't put an undef in an @ARGV argument from the command line because all
command-line arguments are strings. However, you can have it as an empty
st
Or let me put it this way - How can we pass an input parameter as an undef
Cheers,
Parag
On Sun, Jan 10, 2010 at 1:23 AM, Parag Kalra wrote:
> Hello All,
>
> This is surely a beginner's question and may even sound silly. :)
>
> How do you make a Perl script skip an input parameter if it is n