There are a handful of reasons to close and reopen a filehandle repeatedly:
If none of these apply, you can save some cycles by leaving it open. You may save a small bit of memory while it's not open. Whether either of these is worthwhile to worry about I can't say without measuring. I doubt this is a matter of any concern unless you're closing and reopening in a tight loop.
In reply to Re: Tip on better performance: Open and close output file or leave it open?
by mr_mischief
in thread Tip on better performance: Open and close output file or leave it open?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |