On Thu, Mar 19, 2009 at 05:27, <practicalp...@gmail.com> wrote: > I don't know how to calculate an IP range. > for example, > > 202.102.128.0/17 - 202.102.192.0/19 = ? > > I mean the first range excludes the second, and what will be gotten. snip
Take a look at Net::CIDR::Set[1] and the other modules[2] that work with CIDR notation. #!/usr/bin/perl use strict; use warnings; use Net::CIDR::Set; my $network1 = Net::CIDR::Set->new("202.102.128.0/17"); my $network2 = Net::CIDR::Set->new("202.102.192.0/19"); $network1->remove($network2); print map "$_\n", $network1->as_cidr_array; $network1->remove($network2); print map "$_\n", $network1->as_cidr_array; 1. http://search.cpan.org/dist/Net-CIDR-Set/lib/Net/CIDR/Set.pm 2. http://search.cpan.org/search?query=CIDR&mode=all -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/