endhostent |
让你的系统不再期望使用gethostent从主机文件中读取条目。
None
试试下面的例子:
#!/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"; } #by www.gitbook.net endhostent(); # Closes the database;