##
chown my_user_name my_program_name.pl
####
($<,$>)=($>,$<); # Swap effective and actual user ID
open(FILE, ">>/tmp/myfile") or die "Can't open /tmp/myfile";
print FILE "stuff";
close(FILE);
($>,$<)=($<,$>); # Swap effective and actual user ID