Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Can't copy file

by Laurent_R (Canon)
on Mar 30, 2015 at 20:56 UTC ( #1121900=note: print w/replies, xml ) Need Help??

in reply to Can't copy file

As I already told you on your cross-post on the Perl Guru forum (;#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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121900]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2022-01-17 02:29 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (50 votes). Check out past polls.