Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL setnetent Function
Syntax
Definition and Usage
As getnetent() retriews the information fro the next line in the network database, then setnetent sets (or resets) the enumeration to the beginning of the set of host entries. This function should be called before the first call to getnetent. The STAYOPEN argument is optional and unused on most systems.
Return Value
Example
Try out following example:
#!/usr/bin/perl
use Socket;
while ( ($name, $aliases, $addrtype, $net) = getnetent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addrtype = $addrtype\n";
print "Net = $net\n";
}
setnetent(1); # Rewind the database;
while ( ($name, $aliases, $addrtype, $net) = getnetent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addrtype = $addrtype\n";
print "Net = $net\n";
}
endnetent(); # Closes the database;
|
|

|
|
|