[Chapter 3] 3.2.44 getgrent
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:50:01Z

#

| Chapter 3 Functions |

### 3.2.44 getgrent

    getgrent
    setgrent
    endgrent

These functions do the same thing as their like-named system library routines - see getgrent(3). These routines iterate through your /etc/group file (or its moral equivalent coming from some server somewhere). The return value from getgrent 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. To set up a hash for translating group names to gids, say this:

    while (($name, $passwd, $gid) = getgrent) {
        $gid{$name} = $gid;
    }

In scalar context, getgrent returns only the group name.

3.2.43 getc |  | 3.2.45 getgrgid