The getprotobyname takes the protocol name as an argument and returns its name, any aliases, and its protocol number.
# Format: getprotobyname(NAME);
($name, $aliases, $proto ) = getprotobyname('tcp');
print "name=$name\taliases=$aliases\t$protocol number=$proto\n";
Related examples in the same category