in reply to RE: Re: gethostbyname bug?
in thread gethostbyname bug?
my ($ip) = gethostbyname("slashdot.org");
In that code, $ip is in a list, and the statement is in list context, so the statement is equivalent to:
my ($ip, undef, undef, undef, undef) = gethostbyname("slashdot.org");
which will put the name in returned from gethostbyname in $ip.
Aside: This is the reason I rail against unnecessary parenthisation in perl programs---there can be nasty context bugs until you get used to it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Re: gethostbyname bug?
by geektron (Curate) on Sep 12, 2000 at 02:13 UTC | |
by Nooks (Monk) on Sep 12, 2000 at 02:58 UTC |