Jim schreef:
> Given a wordlist @WordList and a file $content,
> how do I construct a regexp to search for every
> word in @WordList in $content.
>
> I have tried the following, which does not work:
>
> foreach $i (@WordList)
> {
> print "Searching: " . $i . "\n\n";
> if($content =~ m/$i/)
> {
> print "Found Word " . $i . "\n";
> }
> }
What do you mean by "does not work"?
Maybe you are looking for
m/\b\Q$word\E\b/
or maybe you just forgot to chomp.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/