|Just another Perl shrine|
Quickly determine which IP range an IP belongs to.by punch_card_don (Curate)
|on Nov 30, 2010 at 01:48 UTC||Need Help??|
punch_card_don has asked for the
wisdom of the Perl Monks concerning the following question:
I have a long list of IPs and IP ranges that correspond to various users. Then I'm given a single IP address and need to determine which user it is. For example, my user IPs might look like:
User 1 = abc.def.ghi.001 abc.def.ghi.002 abc.def.ghi.003
and so on for dozens or hundreds of users.
Then, given a single IP adress, determine which user it is. Prefereably without having to do something brute force like looping through every range with a subnet mask module to test against my IP.
All good ideas will be greatly appreciated.
Time flies like an arrow. Fruit flies like a banana.