in reply to Match a Range of IP's

Check out Net::CIDR. You want the range2cidr and cidrlookup functions.