in reply to Re^2: Issue with matching regex
in thread Issue with matching regex

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.


🦛