Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL getprotobyname Function
Syntax
Definition and Usage
Translates the protocol NAME into its corresponding number in a scalar context, and
its number and associated information in a list context:
($name, $aliases, $protocol_number)
Return Value
In scalar context undef on error otherwise protocol number.
In list context empty list on error protocol record (name, aliases, protocol number)
Example
Try out following example:
#!/usr/bin/perl
($name, $aliases, $protocol_number) = getprotobyname("tcp");
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Protocol Number = $protocol_number\n";
It produces following result
Name = tcp
Aliases = TCP
Protocol Number = 6
|
|

|
|
|