use strict; use English; use File::Copy qw(cp); use Crap qw(croak); my ($old_euid,$old_egid); $old_euid = $>; $old_egid = $); # now change the euid and egid to "user1" $> = "23333"; # new uid $) = "7755"; # "user1" primary group. croak("failed to copy ") unless ( cp("/var/tmp/srcfile","/x/tmp/dstfile") );