in reply to Re: gethostbyname one-liner: Improvements?
in thread gethostbyname one-liner: Improvements?
The "". in ikegami's solution casts the gethostbyname call as a string, but more importantly it puts it in scalar context instead of the list context it would ordinarily be in as a parameter to inet_ntoa. We want the scalar context because then gethostbyname returns just the packed IP address. In list context it would return more stuff we're not interested in. Using "". here is basically a golfy way to say scalar.
|
|---|