http://qs1969.pair.com?node_id=357410

u235sentinel has asked for the wisdom of the Perl Monks concerning the following question:

I've been working with this off and on for some time. I have a couple solutions that work however I don't feel they are as clean as they can be. I'm trying to use a loop and have run into some trouble. I "thought" I was asking perl to print any lines that match my @matches list. It comes back blank. I've been searching several books and google. I'm just not seeing the mistake. What am I missing?

Here is the code. Any insights on what I missed is greatly appreciated.

use strict; use warnings; my @netstat = `netstat -s`; my @matches=("invalid headers", "packets dropped"); foreach my $matches (@netstat) { my @results = grep(/@matches/, @netstat); #print "I am here\n"; print @results; }