I just realized I was not chomping <STDIN>. Thanks.
-----Original Message-----
From: Wert, Nathaniel
Sent: Friday, November 02, 2001 5:19 PM
To: 'Maxim Berlin'
Cc: '[EMAIL PROTECTED]'
Subject: RE: gethostbyname and getnetbyname
Maybe it comes in the statement before that:
$nodename = <STDIN>;
$iaddr = gethostbyname($nodename);
($a,$b,$c,$d) = unpack('C4',$iaddr);
$ipaddress = "$a.$b.$c.$d";
print $ipaddress;
I have debugged this numerous times and I can't seem to understand why gethostbyname
does not return anything. I have tried with both the hostname and the
hostname.foo.com notation and it does not work.
It does work when I replace $nodename with 'node.foo.com' but I can't get the imputed
variable to work?
Thanks,
Nate.
-----Original Message-----
From: Maxim Berlin [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: gethostbyname and getnetbyname
Hello Nathaniel,
Friday, November 02, 2001, Wert, Nathaniel <[EMAIL PROTECTED]> wrote:
WN> 1) I can get gethostbyname to work in this format:
WN> gethostbyname('node.foo.com'). I need it to work in the following
WN> format: gethostbyname($nodename). Is this not set up for that?
$nodename='node.foo.com';
$ent=gethostbyname($nodename);
where is your problem?
example:
use Socket;
use Net::hostent;
$h = gethostbyname("www.perl.com");
print "name:", $h->name," address:",inet_ntoa($h->addr),"\n",
Best wishes,
Maxim mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]