Example Perl script t1.pl: use strict; sub dump_user_details { my $uid = shift; my ($user, $u, $pgid, $home, $shell) = (getpwuid($uid))[0,2,3,7,8]; print "ruid='$<' euid='$>' uid='$uid' u='$u' pgid='$pgid'\n"; print "user='$user' home='$home' shell='$shell'\n"; my @gids = ( $pgid ); while (my ($name, $pw, $gid, $members) = getgrent) { push(@gids, $gid) if grep($_ eq $user, split(' ', $members)); } endgrent(); print "gids:@gids:\n"; } my $arg1 = shift; print "arg1='$arg1'\n"; dump_user_details($<); dump_user_details($>) if $> != $<;