Rick Delaney writes:
> The overlapping strings also cause problems for this method:
> 
>     $x <= grep { $string =~ m/$_/ } @words;
> 
> If $string is "foobar" and @words is qw(foo foobar) then this results
> in two words found which I don't think the OP was looking for.

  $x <= grep { $string =~ /\b\Q$_\E\b/ } @words;

-- 
Aaron Crane

Reply via email to