Copyright © tutorialspoint.com

PERL getnetbyaddr Function


Syntax

getnetbyaddr ADDR, ADDRTYPE


Definition and Usage

In a list context, returns the information for the network specified by ADDR and type ADDRTYPE:

($name, $aliases, $addrtype, $net)

Return Value

  • In scalar context undef on error otherwise Network address.

  • In list context Empty list on error otherwise Network record (name, aliases, address type, network address).

Example

Try following example:

#!/usr/bin/perl

use Socket;

$iaddr = inet_aton("127.1"); # or whatever address
($name, $aliases, $addrtype, $net)  = getnetbyaddr($iaddr, AF_INET);

print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addrtype = $addrtype\n";
print "Net = $net\n";


Copyright © tutorialspoint.com