in reply to To get the secondary groups for linux

On the off chance that you are more interested in the current group membership of the current running process, there's POSIX::getgroups.
use POSIX qw(getgroups); # get list of the current groups for this process my @gidlist=getgroups(); # you'd have to translate numeric gid's to # the names here
Update:

Here's another shot at getting secondary groups, this one from the id command in the Perl Power Tools project:

while ( my($name,$pw,$gid,$members) = getgrent ) { push(@rgids,$gid) if ( grep($_ eq $user,split(/\s+/,$members)) ); }