Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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 (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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2022-01-18 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (54 votes). Check out past polls.

    Notices?