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 <[email protected]> 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 'uninitialized'; > print "1 - $ARGV[0]\n"; > print "2 - $ARGV[1]\n"; > print "3 - $ARGV[2]\n"; > > When I execute this as - perl Input.pl one two three > > I get following O/P > > 1 - one > 2 - two > 3 - three > > Now suppose I don't want to give second parameter - perl Input.pl one > three > > I get following O/P: > > 1 - one > 2 - three > 3 - > > My requirement is - > > 1 - one > 2 - > 3 - three > > I tried giving extra white space but still 'three' is being taken as 2nd > input parameter and I guess white space is a default delimiter. Is there any > special delimiter which I can use to skip an I/P parameter. > > Cheers, > Parag > > >
