getprotoent function reads the next line from the network protocols database, /etc/protocol, and returns a list.
#Format
#getprotoent;
#setprotoent (STAYOPEN);
#endprotoent;
while (($name, $aliases, $proto ) = getprotent){
printf "name=%-5s,aliases=%-6sproto=%-8s\n",
$name, $aliases, $proto;
}
Related examples in the same category