> 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 call that a "double grep". Others may call it perl "golf". =) (Note, everything I think I'm inventing I discover has already been invented many times, so I probably won't take credit, even though I didn't get this from anywhere.) Let me know if you want to understand how it works but can't figure it out. - Bryan -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/