#!/usr/bin/perl -w
use Net::IP;
my $ip= new Net::IP('192.168.0.0');
my $cut=16;
my $net1=substr($ip->binip(),0,$cut);
my $input=$ARGV[0];
my $new=new Net::IP($input);
my $net2=substr($new->binip(),0,$cut);
print "$net1\n$net2\n";
if($net1 eq $net2)
{
print "yes\n";
}
else{
print "no\n";
}
转载于:https://blog.51cto.com/biott/1104650