in reply to How do I search for every occurrence of strings within an array and display them?

Assuming you want to match "words", and not part of words (that is, if one of your keywords is "perl", you don't want it to trigger on "properly"), I'd do the following (untested):
use 5.010; use strict; use warnings; use autodie; open my $kwh, "keywords.txt"; while (<$kwh>) { chomp; $keyword{$_}++ for split /,/; } close $kwh; open my $fh, "Skypelogs.txt"; while (<$fh>) { print if grep {$keywords{$_}} /(\pL(?:\S*\pL)?)/g; } close $fh;
Note the definition of a "word": any sequence of non-space characters that start and end with a letter. This is far from perfect.
  • Comment on Re: How do I search for every occurrence of strings within an array and display them?
  • Download Code