Answers are already given but I was driven (
tye made me do it :) to add lookup functionality to
Net::CIDR::Lite(0.07). There's two ways to look up,
looking up a single ip address in a Net::CIDR object, and looking up many ip addresses in several labeled Net::CIDR::Lite objects (kind of like Array::IntSpan, but looking up everything at once is more efficient than looking up one thing at a time since my searches are sequential, i.e. O(n), except for an initial sort which is
cached for subsequent searches, and Array::IntSpan is O(log n) (but for small 'n' it doesn't really matter, eh?)).
Array::IntSpan has already been chosen as the 'favoured' answer by the OP (and I tend to agree for his particular needs), but if you ever need IPv6 support...try out Net::CIDR::Lite.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.