in reply to Pattern matching problem
The one issue to be concerned about is that the split could fill up memory. An alternative way to extract the words one at a time would be:for (split ' ', $sequences) { if (/\Q$quart1/ and /\Q$quart2/) { print "Found both in $_\n"; } }
while (my ($word) = $sequences =~ /(\S+)/g) { if (index($word, $quart1) >= 0 and index($word, $quart2) >= 0) { print "Found both in $word\n"; } }
|
|---|