in reply to Alternative to querying a database to save time
You could join all the search terms into one big regexp:
my $re = join '|', map { chomp; $_ } <FILE2>;then fetch all the abstracts for each of your keys and run the regexp against each of them. Take care to precompile it with $re = qr/$re/. If you'd like the terms to only be found as whole words, something like $re = qr/\b(?:$re)\b/ should do.
With that many terms, it's probably well worth using Regexp::Trie:
use Regexp::Trie; my $rt = Regexp::Trie->new; while(<FILE2>) { $rt->add($_); } $rt = $rt->regexp;
You can still add the word boundary stuff as above then.
|
|---|