Perl functions references-getnetent Function - Perl Scripting

what is getnetent function in Perl? what is its syntax?

Description

This function gets the next entry from the /etc/networks file, returning − ($name, $aliases, $addrtype, $net)
If /etc/networks file signifies empty, then it would not return anything and call will fail..

Syntax

Following is the simple syntax for this function −

Return Value

This function returns undef on error otherwise Network address in scalar context and empty list on error otherwise Network record (name, aliases, address type, network address) in list context.

Example

Following is the example code showing its basic usage −
When above code is executed, it produces the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Perl Scripting Topics