Tutorials Point


  Perl Home

  PERL Functions

© 2013 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL endhostent Function



Advertisements

Syntax

endhostent


Definition and Usage

Tells the system you no longer expect to read entries from the hosts file using gethostent.

Return Value

  • None

Example

Try out following example:

#!/usr/bin/perl

while( ($name, $aliases, $addrtype, $length, @addrs) = gethostent() ){
   print "Name  = $name\n";
   print "Aliases  = $aliases\n";
   print "Addr Type  = $addrtype\n";
   print "Length  = $length\n";
   print "Addrs  = @addrs\n";
}

sethostent(1);

while( ($name, $aliases, $addrtype, $length, @addrs) = gethostent() ){
   print "Name  = $name\n";
   print "Aliases  = $aliases\n";
   print "Addr Type  = $addrtype\n";
   print "Length  = $length\n";
   print "Addrs  = @addrs\n";
}

endhostent();  # Closes the database;


Advertisements


  

Advertisements