Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL setnetent Function



Syntax

setnetent STAYOPEN


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

  • Nothing

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;


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names