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

Perl endservent()函數

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

語法

endservent


定義和用法

讓你的係統不再期望使用getservent從服務文件讀取條目。

返回值

  • None

實例

試試下麵的例子:

#!/usr/bin/perl


while(($name, $aliases, $port_number,
     $protocol_name) = getservent()){

   print "Name = $name\n";
   print "Aliases = $aliases\n";
   print "Port Number = $port_number\n";
   print "Protocol Name = $protocol_name\n";

}

setservent();   # Rewind the database;

while(($name, $aliases, $port_number,
     $protocol_name) = getservent()){

   print "Name = $name\n";
   print "Aliases = $aliases\n";
   print "Port Number = $port_number\n";
   print "Protocol Name = $protocol_name\n";

}
#by www.gitbook.net
endservent();  # Closes the database;