my $ip = new NetAddr::IP 'loopback'; print "The address is ", $ip->addr, " with mask ", $ip->mask, "\n" ; if ($ip->within(new NetAddr::IP "127.0.0.0", "255.0.0.0")) { print "Is a loopback address\n"; } # Or - more likely you want to use this .. $me->contains($other) ...