Help for this page
<domain> ::= <subdomain> | " " ... upper case and a through z in lower case <digit> ::= any one of the ten digits 0 through 9
use Net::DNS::DomainName; my $host = "foo.example.com"; my $bare = (Net::DNS::DomainName->new($host)->label)[0]; print "$bare\n"; # prints "foo"