The even better news is that the original if condition can be much simplified and by combining the first 2 regexen it can avoid the fully empty pattern into the bargain:
if ($line =~ /$var1|$var2/i && $check =~ /YES/i) { print "Inside if\n" +;} else {print "Outside if\n";}
Of course if we still have $var1 = '' then it will still match but that's a question for KishKishore as to what they actually intend.
🦛
In reply to Re^3: Issue with matching regex
by hippo
in thread Issue with matching regex
by KishKishore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |