use Regexp::Common qw( net ); my %interesting_ips; while( ) { chomp; $interesting_ips{ $_ } = 1; } while( my $fw_line = ) { while( my( $addr ) = $fw_line =~ m{($RE{net}{IPv4})}g ) { say qq{$.: found interesting address '$addr'} if exists $interesting_ips{ $addr }; } }