in reply to Not Matching String is Matching

I don't know if you were looking to block more than one ip address with 192.168.188.3, since it also blocks addresses 192.168.188.30 through 192.168.188.33. I encountered this problem some time back and as such am offering my solution:

my @ips_to_ignore = qw( 192.168.188.3 192.168.11.141 192.168.140.110 ); my $ignore = join "|",map(qr(\Q$_\E),@ips_to_ignore); $ignore = qr[^(?:$ignore)$]; while (<DATA>){ chomp; print if ($_ !~ /$ignore/); } __DATA__ 192.168.188.3 192.168.11.141 192.168.140.110 192.168.188.33 192.168.187.12 ---output: 192.168.188.33 192.168.187.12

Hope this helps.

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1