How to copy a file in Perl is as follows:
It worked well a copy command in a Windows environment for not behaving as expected despite the Linux, leave a note.
- File existence check
- to open
- close
- to copy
A specific code is as follows:
if(-e $temporaryFile){
#file exists
} else {
#file does not exists
open(TMPFILE,">$temporaryFile") or die $!;
close(TMPFILE);
}
copy($actualFile, $temporaryFile);
タグ:Perl