On Tue, Jan 10, 2006 at 12:25:20PM -0700, Philip Prindeville wrote: > >>I thought about all of this, by the way... And then remembered that > >>some networks are made of two or more adjacent CIDR blocks, but of > >>unequal size, or not aligned (mergeable). Look at: > >> > >> '212.145.160.0/21' => 'REJECT', > >> '212.145.192.0/20' => 'REJECT', > >> > >>for example. That is actually the range 212.145.160.0 - > >>212.145.223.0. > >> > >>So Patricia wouldn't work in this case. > > Well, yes. But I was hoping to add support for address ranges as well... > I.e. "212.145.160.0-212.145.223.255" (since that's how some of them are > stored > in the various ARIN, RIPE, and APNIC whois databases).
So? Net::CIDR::Lite to the rescue: $ perl -MNet::CIDR::Lite -le \ 'print join("\n", Net::CIDR::Lite->new("212.145.160.0-212.145.223.255")->list)' 212.145.160.0/19 212.145.192.0/19 -- #!perl -wpl # mmfppfmpmmpp mmpffm <[EMAIL PROTECTED]> $p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+ $_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9, 3,1)]),5,1)='`'lt$&;$f.eig; # Jan-Pieter Cornet _______________________________________________ NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it. Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com http://lists.roaringpenguin.com/mailman/listinfo/mimedefang