Web | This Site

Perl Home
PERL Functions
© 2011 TutorialsPoint.COM

| Home |  | References |  | About TP |  | Advertising

# 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";

Advertisement

Online Image Processing

Indian Baby Names