http://www.perlmonks.org?node_id=186582


in reply to Unexpected behavior with Net::Netmask

My initial guess would be that a range of IPs as you've specified will only work correctly if Net::Netmask can make it into a bit mask, and that it doesn't work with generic IP ranges. The lowest 4 bits of 218 are "1010" and th e lowest 4 bits of 221 are "1101". You can't make a single bitmask which only covers that range.

Update:Or, maybe Net::Netmask builds the smallest netmask which will cover both of the IPs specified; in which case, if they don't mark the boundaries of a net block, then the netmask ends up specifying a larger netblock than you intended. I'd use the mask() method to print out the netmask it thinks it has.

Alan