Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL endhostent Function
Syntax
Definition and Usage
Tells the system you no longer expect to read entries from the hosts file
using gethostent.
Return Value
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;
|
|

|
|
|