http://www.perlmonks.org?node_id=67353


in reply to Re: gethostbyname not working
in thread gethostbyname not working

This gets me further, when I print them out however, I get numbers that are no relative the the IP address, or even close. for instance, yahoo.com
my $hostname = 'yahoo.com'; my $addr = (gethostbyname($hostname))[0]; my ($a,$b,$c,$d) = unpack('C4',$addr); print "$a.$b.$c.$d\n";

This prints out: 121.97.104.111
which is not even close to yahoo's IP (I know yahoo has a large subnet, but this doesn't even start with the same number). Any ideas?