develooper Front page | perl.beginners | Postings from April 2002

checking if domain or IP address

Thread Next
From:
David Ulevitch
Date:
April 30, 2002 17:50
Subject:
checking if domain or IP address
Message ID:
10571450546.20020430195129@everydns.net
Hello beginners,

  I have a small perl script which checks to see if input is a
  hostname or an IP address before writing it to a file.

  I was just checking to see if the first char was a number or a digit
  but there are some cases where a hostname can start with a number.
  (like 3.14159.com for example)

  So the question is, if I have a variable like $nameserver
  how can I test to see if it's a hostname or an IP?

-- 
Best regards,
 David                          mailto:davidu@everydns.net



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About