Copyright © tutorialspoint.com

PERL getprotoent Function


Syntax

getprotoent


Definition and Usage

Returns the next entry from the list of valid protocols:

($name, $aliases, $protocol_number)

Return Value

  • In scalar context undef on error otherwise protocol name.

  • In list context empty list on error protocol record (name, aliases, protocol number)

Example

Try out following example:

#!/usr/bin/perl

while(($name, $aliases, $protocol_number) = getprotoent()){
   print "Name = $name\n";
   print "Aliases = $aliases\n";
   print "Protocol Number = $protocol_number\n";
}


Copyright © tutorialspoint.com