if(($check =~ m/YES/i) and (($line =~ m/$var1/i) || ($line =~ m/$var2/i))) { print "Inside if\n";} else {print "Outside if\n";}