in reply to IP to numeric value.
I'd write your function like this:
use Socket qw/ inet_aton /; sub ipToNum { my $ip = shift; return unpack "N", inet_aton( $ip ); }
If your database is MySQL, it also has native versions of those functions, so you could run queries like
select inet_ntoa( ipnum ) from iptable
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IP to numeric value.
by cerror (Scribe) on Jul 12, 2007 at 01:16 UTC | |
by Mutant (Priest) on Jul 12, 2007 at 10:32 UTC | |
by rhesa (Vicar) on Jul 12, 2007 at 18:46 UTC |