Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Matches wuth CIDR range?
March 9, 2009, 4:43 pm
rate this thread
Using Net::CIDR, I was unable to get a subset of how many IP adresses fall
into a certain range. For instance, I'd like to know how many IP addresses
fall into this (fake) range:
When I have addreses stored in @iplist, where @iplist is a list of IP
addresses to which client IP addresses are added (by a mail server
milter). Net::CIDR can only look up 1 IP address at the time (to see
whether it's within the specified range). Yet I'd like to know many
currently in @iplist are within range. Something like:
$count = within ('18.104.22.168/24', @iplist);
Surprisingly, I couldn't find any module on CPAN that has such
functionality. Am I overlooking an easy method? Or does anyone perhaps
know of a module to accomplish this?