http://qs1969.pair.com?node_id=33632


in reply to Test the syntactic validity of a domain name

It matches newlines at the end of the domain name :-

print could_be_a_host("www.domain.com\n"); # says 1
\z instead of $ in the regexps would fix it for recent perls as would a judicously placed chomp - but I'm sure you know this already!