Hi,

if I have a script that accepts any combination of the 5 or maybe even more 
options, say, option1, option2, option3...


Now, after collecting the options, for each option, there is a corresponding 
regexp pattern. I will then build an if statement, where the test should be, 
all the options entered must match (&&) otherwise, return false.
I'm thinking this can only be done by nested if's:

if ($word =~ /$option1/ && $word =~ /$option2){
  if ($word =~ /$option3/ && $word =~ /$option4){
     if ($word =~ /$optionN/){
        print "All pattern matched!\n";
     }
  }
}


Now I'm thinking, it is quite impossible to dynamically create all those if 
tests. Perhaps I can just open a file for writing, write a new perl script 
which will have those codes, and execute it at the end. 

Is there a better way of doing this?









      

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to