Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL gethostbyaddr Function
Syntax
gethostbyaddr ADDR, ADDRTYPE
|
Definition and Usage
Contacts the system's name-resolving service, returning a list of information for the host ADDR of type ADDRTYPE, as follows:
($name, $aliases, $addrtype, $length, @addrs)
The @addrs array contains a list of packed binary addresses. In a scalar context, returns the host address
Return Value
Example
Try following example:
#!/usr/bin/perl
use Socket;
$iaddr = inet_aton("127.1"); # or whatever address
$name = gethostbyaddr($iaddr, AF_INET);
print "Host name is $name\n";
|
|

|
|
|