in reply to Re^4: Module to get domain name from hostname
in thread Module to get domain name from hostname

Your string $hostname still has the newline at the end of it, which is why the error message shows on two lines:

Invalid TLD found in '200-206-30-98.customer.tdatabrasil.net.br ' at b2.pl line 9.

Remove all whitespace from the end of $hostname after you've read it from the file:

$hostname =~ s/\s+$//;

That way, the call to public_suffix() should succeed.

Replies are listed 'Best First'.
Re^6: Module to get domain name from hostname
by Anonymous Monk on Jan 30, 2015 at 14:07 UTC
    Thanks for the help. It works as it should.