sethostent STAYOPEN |
由于gethostent()检索信息的主机数据库中的下一行,然后gethostent集(套)枚举的主机项设置开始。这个函数应该被调用之前第一次调用gethostent。STAYOPEN参数是可选的,在大多数系统上未使用过的。
Nothing
试试下面的例子:
#!/usr/bin/perl
#by www.gitbook.net
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;