sunshine_august has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to turn asic ip address like "172.16.249.232" into an int or long integer numeric, and I use the module NetAddr::IP::Util, but failed, it seems that the inet_aton() doesn't returns a numeric value
The simple code like this:and, gives the following messages:#!/usr/bin/perl use strict; use warnings; use NetAddr::IP::Util qw(:all :inet :ipv4 :ipv6 :math); my $netaddr = inet_aton( '172.16.249.232' ); print "net_addr:", $netaddr, "\n"; printf "net_addrHex:%x\n", $netaddr;
net_addr:▒▒▒ Argument "▒^P▒▒" isn't numeric in printf at /foo.pl +line 10. net_addrHex:0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Does inet_aton() return a numeric value?
by JavaFan (Canon) on Nov 21, 2008 at 10:45 UTC | |
|
Re: Does inet_aton() return a numeric value?
by Anonymous Monk on Nov 21, 2008 at 18:08 UTC |