Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Close a file and reopen a new one at midnight

by 0day (Sexton)
on Jan 14, 2013 at 17:59 UTC ( #1013251=note: print w/ replies, xml ) Need Help??


in reply to Close a file and reopen a new one at midnight

You have to use a global variable of an open file:

my $file; open $file, ">$filename" || die("Couldn't open file"); ...

In addition, are you assured that at this time there is data on the socket for reading?


Comment on Re: Close a file and reopen a new one at midnight
Download Code
Re^2: Close a file and reopen a new one at midnight
by MidLifeXis (Prior) on Jan 14, 2013 at 18:01 UTC

    That, however stylish it may be, using lexical file handles will not resolve the root cause of the problem. The file handle is being closed and reopened in a logically correct location.

    Update: Updated statement to clarify.

    --MidLifeXis

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-12-27 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls