in reply to Re: Checking IP's with an IP/mask
in thread Checking IP's with an IP/mask
use Socket; sub IsInRange { my ($addr,$base) = @_; my $bits; ($base, $bits) = split /\//, $base; return ( (unpack("N", inet_aton($base)) >> (32 - $bits)) == (unpack ("N", inet_aton($addr)) >> (32 - $bits)) ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Checking IP's with an IP/mask
by tadman (Prior) on Apr 24, 2001 at 18:49 UTC |