in reply to perl and getaddrinfo API
Hello swissknife,
If you display the contents of $pip using Data::Dump, say, you’ll see that it actually contains four bytes:
#! perl use strict; use warnings; use Socket; use Data::Dump; my $server = shift @ARGV; my $pip = gethostbyname($server); dd $pip; my $IP_add = inet_ntoa($pip); print $IP_add;
Output:
21:17 >perl 1602_SoPW.pl perlmonks.pair.com "\xD1\xC5{\x99" 209.197.123.153 21:17 >
If these bytes don’t appear when you print $pip, that’s likely because they happen to be unprintable.
BTW, the documentation for Socket mentions that gethostbyname is a legacy subroutine.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl and getaddrinfo API
by swissknife (Sexton) on Apr 20, 2016 at 12:28 UTC | |
by Athanasius (Archbishop) on Apr 20, 2016 at 12:47 UTC | |
by VinsWorldcom (Prior) on Apr 20, 2016 at 17:29 UTC |