in reply to Re: Executing data based on command line arguments
in thread Executing data based on command line arguments
I know how to check command line options,let me be explicit in my query again.Lets use the below sample code. In the below code
1."print $line"should get executed no matter what (even if the option is not c),but 2. when option is "c"am checking for line in @array and then printing $line.
if ($options(C) && grep /line/,@array) { print $line; }
I know we can do the following,but how do I satisfy both conditions without using if-else,as an example I gave print $line,there are many more instructions in my script which i dont want to repeat
if ($options(C) && grep /line/,@array) { print $line; } else #when option "c" is not given { print $line; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Executing data based on command line arguments
by Anonymous Monk on Dec 15, 2010 at 05:33 UTC | |
|
Re^3: Executing data based on command line arguments
by johna (Monk) on Dec 15, 2010 at 14:42 UTC |