Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL setprotoent Function
Syntax
Definition and Usage
As getprotoent() retriews the information for the next line in the protocol database, then setprotoent sets (or resets) the enumeration to the beginning of the set of host entries. This function should be called before the first call to getprotoent. The STAYOPEN argument is optional and unused on most systems.
Return Value
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";
}
setprotoent(1); # Rewind the database.
while(($name, $aliases, $protocol_number) = getprotoent()){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Protocol Number = $protocol_number\n";
}
endprotoent(); # Closes the database
|
|

|
|
|