#NOT OK print "OK\n" if ($test =~ /[753]/);
I think you were on the right track with why the last one wasn't good. Try with any of the following input, and you'll see why: 50, 72, 39, 256. You want to anchor your regexes when testing for equality:
print "OK\n" if ($test =~ /^[753]$/);Update: I can't spell.
In reply to Re: IF and some conditions
by jhourcle
in thread IF and some conditions
by uksza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |