in reply to Re: Sorting log files with IP addresses (duplicates)
in thread Sorting log files with IP addresses (duplicates)

From the inet_aton docs:
For portability do not assume that the result of inet_aton() is 32 bits wide, in other words, that it would contain only the IPv4 address in network order.
Using pack is probably a better option:
my $ip = pack(C4 => split /\./, $src);

Replies are listed 'Best First'.
Re^3: Sorting log files with IP addresses (duplicates)
by jwkrahn (Abbot) on Apr 23, 2006 at 01:40 UTC
    True, it depends on the characteristics of inet_aton(3) however using pack() and split() only works if the IP address is in the dotted quad format while inet_aton() will work with any valid IP address and return undef if the address is not valid.