Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL setgrent Function
Syntax
Definition and Usage
Sets (or resets) the enumeration to the beginning of the set of group entries. This
function should be called before the first call to getgrent.
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
while( ($name,$passwd,$gid,$members) = getgrent() ){
print "Name = $name\n";
print "Password = $passwd\n";
print "GID = $gid\n";
print "Members = $members\n";
}
setgrent(); # Set the beginnging of the group database;
print "Again reading /etc/passwd file\n";
while( ($name,$passwd,$gid,$members) = getgrent() ){
print "Name = $name\n";
print "Password = $passwd\n";
print "GID = $gid\n";
print "Members = $members\n";
}
endpwent; #claose the database;
}
|
|

|
|
|