I have the following code:
$st2 = quotemeta($st);
if ( $line =~ m/$st2\z/ ) {
print "GOOD\n";
}
else {
print "BAAAAAAD\n";
}
The $line I get it from a file. I read the entire file and then do a:
foreach $line in @file {...}
For me it only prints BAAAAAAD. Also, $line can contain “clear”, “clearer”, “clearest” or some other words but I want to match all “clear” instances, afterwords I want to match all “clearer” instances and so on.
NOTE: “clear” should not match “clearer” or “clearest”. It should only match “clear”
Here is what works:
This also works (shows “no match”) when $var1 is “clearer”.
Thank you all for your help.