> Hello, I'm trying to write a simple Perl script to output certain lines
> from a logfile that contain any of a few phrases.
[clip]
> my @goodlist = ("word1", "word2");
I had some fun with this one lately. =)
perl -e '@gl=qw/word1 word2/; print grep {$t = $_;grep {$t=~/$_/} @gl } <>'
I ca
Mazza, Glen R. wrote:
1.) (Major question) I was wondering if I could get rid of the foreach
and instead use some construct like:
If (/@goodlist/) {...}
Meaning "if the current line has *any* of the words in the array..."
See `perldoc perlfaq6` and search for /How do I efficiently match