This benchmark uses different methods to check a number of IP addresses against a list of IP ranges. Two of them use Net::Netmask and are predictably slow. One even uses a helper function to call Net::Netmask's match() methods. One method manually defines the required bit shifts and logical OR operations. While this one is the fastest, finding the required numbers can be a pain. The method using Net::IP::Match is only a bit slower than the manual method and much easier to write.
Net::Netmask
match()
Net::IP::Match
On my Powerbook, using the manual method is only 18% faster than using Net::IP::Raw, but Net::IP::Raw is almost 20 times faster than using Net::Netmask.
Net::IP::Raw
To install Net::IP::Match, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::IP::Match
CPAN shell
perl -MCPAN -e shell install Net::IP::Match
For more information on module installation, please visit the detailed CPAN module installation guide.