/^ ([^.]+) (?:\.(.+))? $/x; say "Host: `$1', domain: `$2'"; [download]
In reply to Re: extract a hostname from a fqdn by rjt in thread extract a hostname from a fqdn by iang