programming-examples/perl/Network/Translating hostnames into IP addresses.pl

12 lines
231 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl
use Socket;
my $packed_address = gethostbyname("localhost");
unless ($packed_address) {
print "$_ => ?\n";
next;
}
my $dotted_quad = inet_ntoa($packed_address);
print "$_ => $dotted_quad\n";