use strict; use Net::IP; my $net = new Net::IP("10.4.5.0/24"); my $host = new Net::IP("10.4.5.1"); print "yes\n" if ($net->overlaps($host) == $Net::IP::IP_B_IN_A_OVERLAP);