Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Match a Range of IP's

by runrig (Abbot)
on Sep 30, 2004 at 23:34 UTC ( [id://395508]=note: print w/replies, xml ) Need Help??


in reply to Re: Match a Range of IP's
in thread Match a Range of IP's

NetAddr::IP->new("192.168.1/24")->contains(NetAddr::IP->new($_))
Except that the CIDR address you have doesn't match the OP's desired range (192.168.1.0-192.168.99.255), so he'd have to run your code up to 99 times to see if the address is in that range. Or just another way (not tested):
use Net::CIDR::Lite; my $range = Net::CIDR::Lite->new("192.168.1.0-192.168.99.255"); while (<DATA>) { chomp; print "$_\n" if $range->find($_); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://395508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found