http://www.perlmonks.org?node_id=281666


in reply to Match only certain IP Addresses

In addition to the excellent advice you have already received, if you are going to be doing much manipulation of IP addresses, you will definately want to become friends with the CPAN Module Net::IP...it is a life saver!