The reason for it is that Perl is buffering output to files, so that the "output1.txt" file is probably still empty when you are copying it. By closing the file handle, you force the buffer to be copied to the file. If you don't do that, the file is probably actually populated only when the program ends.
In reply to Re: Can't copy file
by Laurent_R
in thread Can't copy file
by novice2015
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |