in reply to Re: Writing to file with filehandler in variable, scope issue, clobber becomes append
in thread Writing to file with filehandler in variable, scope issue, clobber becomes append
Ok, I've edited to close and open the filehandler each time the loop loops (I agree, seems kind of inefficient, that's why I kept it out of the loop at first). Maybe I'll compare that with the truncate and seek option at some point, but for now it's good enough.
I also get what you mean by using the "END" block. I never knew of it's existence and it does indeed do exactly what I want to do with my cleanup sub. Thanks for that.
The reason I had quit using die was precisely so I could call my sub. But now I have the END construct I have changed all the "unless..."s back to "or die..."s.
I'm not sure I would ever have figured out what I had not understood properly without your help. Even the page for "print" on perldoc doesn't really explain this...
You've been a great help! Thanks again.
All the best, Mark.
|
|---|