note
LanX
I'm still not sure what you're trying to achieve here, cause your <c>grep</c> returns the PATTERNs which matched.<P>
Are those patterns simple words?
If yes you could consider constructing an or-regex:<P>
<c>
DB<100> @patterns=qw#one two three#
DB<101> $str="one two"
DB<102> $re=join "|",@patterns
DB<103> print $str =~ m/($re)/g
onetwo
</c><P>
UPDATE:<P>
just noticed there are still subtle differences:
<c>
DB<106> $str="two one two"
DB<107> print $str =~ m/($re)/g
twoonetwo
DB<108> print grep {$str=~/$_/} @patterns
onetwo
</c>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-708738">
<p>Cheers Rolf
</div></div>
899784
899814