Copyright © tutorialspoint.com

# PERL getnetbyname Function

## Syntax

getnetbyname NAME

## Definition and Usage

In a list context, returns the information for the network specified by NAME

($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;

    ($name, $aliases, $addrtype, $net)  = getnetbyname("loopback");

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

Copyright © tutorialspoint.com