http://qs321.pair.com?node_id=1121900


in reply to Can't copy file

As I already told you on your cross-post on the Perl Guru forum (http://perlguru.com/gforum.cgi?post=81230;#81230), you need to close the file handle ($outfh, not FH) after the end of the for loop and before proceeding to copy the file.

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.

Je suis Charlie.