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

checking if domain or IP address

Thread Next
David Ulevitch
April 30, 2002 17:50
checking if domain or IP address
Message ID:
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 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,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About