Does gethostbyname return a number or a string or ...

From: John Smith (someone_at_microsoft.com)
Date: 11/28/03


Date: Fri, 28 Nov 2003 02:15:40 GMT

I am trying to use the following code but I am not familiar enough with
network commands.

  $ipad=gethostbyname($msvr); # the msvr scalar is the domain name of a
mailserver ex: smtp.domain.com
  print"ipad = $ipad \n";

The result of the above commands is a bunch of odd characters, as shown
below.

  ipad = ƤÈ

I also found the following code on the Internet, and I sorta assumed it was
good code, but of course I could be wrong!

  $ip = gethostbyname($Domain);
  if($ip == "64.94.110.11") {

First of all, the second line of code is using == instead of eq to compare
the contents of $ip with characters.
I thought you could use if($a == 1) , or maybe if($a eq "hello"), but not
if($a == "hello").
Second, why is this code assuming that the contents of $ip may be an ip
address while my result is just odd characters.

In my example, am I able to print the result as an IP address instead of odd
characters?
Any and all information greatly appreciated as always.

G. Doucet



Relevant Pages