chmod '0755', $file; #### use strict; my $infile=shift; my $outfile=shift; my($mode,$uid,$gid)=(lstat($infile))[2,4,5]; my $chmod=sprintf("%04o", ($mode & 07777)); chmod oct($chmod),$outfile or die "Could not chmod"; # and do something with the uid and gid later...