cpc has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (data formatting)
What would be the most efficient way to convert an IP address from hexadecimal to dotted quad notation?
E.g. from 7F000001 to 127.0.0.1
I came up with:
$ip = '7F000001'; use Socket; inet_ntoa( pack( "N", hex( $ip ) ) )
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Converting an IP from hexadecimal to dotted-quad⭐
by merlyn (Sage) on Aug 29, 2002 at 04:26 UTC | |
Re: Converting an IP from hexadecimal to dotted-quad
by Abigail-II (Bishop) on Aug 29, 2002 at 13:28 UTC | |
Re: Converting an IP from hexadecimal to dotted-quad
by jmcnamara (Monsignor) on Aug 29, 2002 at 08:24 UTC | |
Re: Converting an IP format from 7F000001 to 127.0.0.1
by cpc (Hermit) on Aug 29, 2002 at 07:05 UTC |
Back to
Seekers of Perl Wisdom