in reply to Sifting through firewall rules using a script
Yes, beside strict and warnings (always use it!) I suggest you to adopt the lexical filehandle opening form: open(my $fh, "<", "input.txt") or die "Can't open < input.txt: $!";
Then I suspect that you problem arises in line
if ($line =~ $IP) {
because all elements of @IPS end with a \n newline: you can chomp inside the foreach loop too, just before the pattern matching.
L*
PS as Tux noted you are already chomping, but the wrong array: use strict; use warnings; always :)
|
|---|