Hi, In the below code, If the 'line' matches with any of 'var1' or 'var2', then only it should go into if block.
But, even though none of the variables are matching with line, the code is executing lines inside if statement.
Can you please explain what is happening here ?
$line = 'xyz'; $var1 = ''; $var2 = 'abc'; $check = 'Yes'; if((($line =~ m/$var1/i) || ($line =~ m/$var2/i)) and ($check =~ m/YES +/i)) { print "Inside if\n";} else {print "Outside if\n";}
In reply to Issue with matching regex by KishKishore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |