The getservbyname function translates the service port name to its corresponding port number.
Format: getservbyname(NAME, PROTOCOL); ($name,$aliases,$port,$protocol)=getservbyname('telnet', 'tcp');