Tutorials Point

Google
Web This Site

  Perl Home

  PERL Functions

© 2006 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL endhostent Function


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;


Printer Friendly



  

Advertisement