in reply to Use of uninitialized value $i in bitwise and (&) at <Netmask.pm>

In addition to the advice by others: Something is wrong with
if ($block->match($row[$i])){ print "IP address: $row[$i] is inside $block\n"; } else{ print "IP address: $row is not inside $block\n"; }
in the "if" branch, you print $row[$i], while in the "else" branch, you print $row - no wonder your output contains blatant lies as e.g. "IP address: 192.168.1.1 is not inside 192.168.1.0/27" …
I suggest something like
print "IP address: $row[$i] is "; if ($block->match($row[$i])){ print "inside"; } else{ print "outside"; } print " $block\n";
Of course, this isn't ideal either, but less error prone.

Replies are listed 'Best First'.
Re^2: Use of uninitialized value $i in bitwise and (&) at <Netmask.pm>
by dotowwxo (Acolyte) on Dec 19, 2017 at 02:37 UTC
    Hello, will note down the tip for sure! However, its not ideal as the same error still occurs to me :( Appreciate the effort dou :) Thank you :)