Is your question simply "How does one get the TLD of ir1.fp.vip.gq1.yahoo.com
, namely yahoo.com
?"
use Domain::PublicSuffix qw( );
my $dps = Domain::PublicSuffix->new();
my $host = 'ir1.fp.vip.gq1.yahoo.com';
$host =~ s/\.\z//; # D::PS doesn't handle "domain.com.".
my $root = $dps->get_root_domain($host)
or die $dps->error();
say $root;
By the way, you can use the builtin / system call gethostbyaddr
to get the PTR record.
use Socket qw( inet_aton AF_INET );
my $host = gethostbyaddr(inet_aton("206.190.36.45"), AF_INET);