in reply to Not Matching String is Matching

Mr. Muskrat has made some valid coding suggestions.
I would suggest using GREP as in the following code to make the IP searching easier on the eye, and possibly faster ..
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 )); while (<FILE>){ print unless grep(/^$_$/,@ips) > 0; }

Replies are listed 'Best First'.
Re: Re: Not Matching String is Matching
by Anonymous Monk on Aug 16, 2003 at 19:11 UTC

    Not very efficient. grep will always loop through all the items every time, even after the wanted element is found.

    It's better using a loop from where you exit when the item is found.