Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Module for working with IP Addresses and Ranges

by DrHyde (Prior)
on Oct 25, 2010 at 09:41 UTC ( #867173=note: print w/replies, xml ) Need Help??


in reply to Module for working with IP Addresses and Ranges

IMO the canonical tool for this is Net::CIDR. The interface and documentation is kinda clunky in some ways, but it works, and works very well, for both IPv4 and IPv6.
$ perl -MNet::CIDR -e ' print Net::CIDR::cidrlookup( "192.168.1.130", Net::CIDR::range2cidr("192.168.1.120-192.168.1.141") )' 1 $ perl -MNet::CIDR -e ' print Net::CIDR::cidrlookup( "192.168.1.180", Net::CIDR::range2cidr("192.168.1.120-192.168.1.141") )' 0

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://867173]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-07-20 11:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (429 votes). Check out past polls.

    Notices?