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, |
In reply to Re: perl and getaddrinfo API
by Athanasius
in thread perl and getaddrinfo API
by swissknife
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |