C
Chip
Thanks in advance for your help.
I am trying to fill an array by using grep
so I can print out only the lines with ip
addresses in them.
The following prints the system call on
the screen but does not fill the array.
I don't want the system call to print on
the screen, and I want to fill the array.
#!/usr/bin/perl -w
use strict;
my @array = system("ps ax | grep sendmail");
foreach (@array) {
if ($_ =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) {
print "$_ \n";
}
}
Any and all help is appreciated.
Chip
I am trying to fill an array by using grep
so I can print out only the lines with ip
addresses in them.
The following prints the system call on
the screen but does not fill the array.
I don't want the system call to print on
the screen, and I want to fill the array.
#!/usr/bin/perl -w
use strict;
my @array = system("ps ax | grep sendmail");
foreach (@array) {
if ($_ =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) {
print "$_ \n";
}
}
Any and all help is appreciated.
Chip