in reply to Re: INET_NTOA Equivalent
in thread INET_NTOA Equivalent

Here's one more potential way to do it, without loading additional modules. Assuming the IPv4 address is in $address (and of a form matching m/((\d{1,3}\.){3}(\d{1,3}))/ ), then:

$ip_as_long = unpack("N", pack("C4", split(/\D/, $address, 4))); $ip_as_string = join('.', unpack("C4", pack("N", $ip_as_long)));

Hope that helps...