In scalar context, grep returns the number of matched elements, and if that's zero, the condition is false, if it's anything more then zero, it succeeds.if(grep $string eq $_, qw(this that the_other)) { # ... }
Makeshifts last the longest.
In reply to Re: matching strings...
by Aristotle
in thread matching strings...
by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |