Programming Perl

Programming PerlSearch this book
Previous: 3.2.45 getgrgidChapter 3
Functions
Next: 3.2.47 gethostbyaddr
 

3.2.46 getgrnam

getgrnam NAME

This function does the same thing as getgrnam(3): it looks up a group file entry by group name. The return value in list context is:

($name, $passwd, $gid, $members)

where $members contains a space-separated list of the login names of the members of the group. If you want to do this repeatedly, consider slurping the data into a hash (associative array) using getgrent.

In scalar context, getgrnam returns only the numeric group ID.


Previous: 3.2.45 getgrgidProgramming PerlNext: 3.2.47 gethostbyaddr
3.2.45 getgrgidBook Index3.2.47 gethostbyaddr