perlquestion
u235sentinel
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?
<br><br>
Here is the code. Any insights on what I missed is greatly appreciated.
<br><br>
<code>
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;
}
</code>