use strict;
use warnings;
use Socket;

my $ip_string = $ARGV[0] || die "usage: $0 ipaddr";

my $ip = inet_aton($ip_string);
my $host = (gethostbyaddr($ip, AF_INET))[0];
print "$host\n" if (defined($host));