abhishek~/perl ~> cat grp.pl #!/usr/bin/perl $in=; ($name, $passwd, $gid, $members) = getgrgid($in); print "group name: $name \t group id: $gid \n"; if ( $in == $gid ) { print "Success\n"; #how to become "root" here.. exec ("chgrp -R $gid /home/abhishek/cpp") || die "could not do chgrp $!"; } else { print "Group id does not exists, you need to give the existing group id \n"; } abhishek~/perl ~>