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;
}
|