小智 9
你可以试试这个:
#!/usr/bin/perl
use warnings;
use strict;
use NetAddr::IP;
my $first = NetAddr::IP->new('10.0.0.1/24');
my $second = NetAddr::IP->new('10.0.0.5/32');
if ($second->within($first)) {
printf "%s is within %s\n", $second, $first;
} else {
printf "%s is not within %s\n", $second, $first;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7360 次 |
| 最近记录: |