in reply to print() on closed filehandle OUT at B.p line 19, <SH> line 1732.
I'm in doubt whether you are familiar with the quote below. In either case, I believe a good practice would be to close the file handles when they are no longer needed. And it would be better to do it yourself than someone else at a latter stage when doing maintenance or applying patches.
You don't have to close FILEHANDLE if you are immediately going to do another open on it, because open will close it for you. (See open.) However, an explicit close on an input file resets the line counter ($. ), while the implicit close done by open does not.
Though re-opening on the same file handle closes it, you are also not closing SH and OUT after the foreach loop. perl will close it for you when the script ends but still, you should explicitly close them in your code.
|
|---|