當前位置:首頁 » Perl » Perl endhostent()函數

Perl endhostent()函數

perl endhostent()函數,endhostent()函數學習例子,endhostent()函數實例代碼,endhostent()函數教學等

語法

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;