Reference: gethostbyaddr
Author: Ellen Siever, Stephen Spainhour & Nathan Patwardhan
Date: 1999-07-02T01:35:40Z

#

| Chapter 5 Function Reference |

## gethostbyaddr

    gethostbyaddr address, [addrtype]

Retrieves the hostname (and alternate addresses) of a packed binary network address. (addrtype indicates the type of address given. Since `gethostbyaddr` is used almost solely for Internet IP addresses, addrtype is not needed.) The return value in list context is:

>     ($name, $aliases, $addrtype, $length, @addrs)

where `@addrs` is a list of packed binary addresses. In the Internet domain, each address is four bytes long and can be unpacked by saying something like:

>     ($a, $b, $c, $d) = unpack('C4', $addrs[0]);

In scalar context, `gethostbyaddr` returns only the hostname.

Reference: getgrnam |  | Reference: gethostbyname