Mr. Muskrat has found the immediate solution. For your next attempt, let me suggest some improvement in your code, so that it becomes more readable and easier to maintain.
my @ips = (qw( 192.168.188.3 192.168.11.141 192.168.140.110 192.168.186.192 192.168.186.166 192.168.139.50 192.168.139.198 192.168.132.101 )); my $ignore = join "|", @ips; while (<FILE>){ print unless /$ignore/; } # ----------------------- sub ignore { my $ip = shift; for (@ips) { return 1 if $ip =~ $_ } return 0; } while (<FILE>) { print unless ignore($_) }
The first method creates a regular expression from an array. You can add to an array (or delete) much easier than editing such a complicated regex.
The second example uses a subroutine that, depending on the number of your IPs to ignore, can be much quicker than a regex with alternation.
HTH
In reply to Re: Not Matching String is Matching
by cchampion
in thread Not Matching String is Matching
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |