in reply to Re: bitwise operators
in thread bitwise operators
use Socket; $net = "192.168.0.0"; $mask = "255.255.255.240"; $ip = "192.168.0.5"; print "$ip belongs to $net/$mask\n" if ((net2long($ip) & net2long($mas +k)) == net2long($net)); sub net2long { return unpack("N", inet_aton(shift)); }
2005-01-20 Janitored by Arunbear - added code tags, as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: bitwise operators
by fd15k (Novice) on Jan 20, 2005 at 00:57 UTC |