Bad file descriptor when trying to close file handleby fireblood (Scribe)
|on Mar 03, 2022 at 10:56 UTC||Need Help??|
fireblood has asked for the wisdom of the Perl Monks concerning the following question:
Dear wise ones,
I have a "bad file descriptor" problem in one of my Perl programs that I’ve been unable to resolve. I've looked at the other topics on perlmonks and other fora with bad file descriptor in their descriptions but didn't see enough similarities to my problem to resolve it.
My program has the following initial instructions in it:
The open works just fine, and throughout the program I am able to write many messages to the file referenced by $fh_debug.
At the end of the program, I have the following instructions:
When I invoke the module in which this code resides from Strawberry Perl v5.32.1, it works exactly as expected. The last lines in the debug file are
and the program finishes nicely and cleanly. But when I invoke the module from Linux Perl v5.34.0, I again get those same two lines at the end of the debug file, and then get the following message:
What could be causing this? Why would it work perfectly under Strawberry Perl but seem to write its final messages correctly and then paradoxically issue those error messages under (Red Hat 7) Linux Perl?
Thank you.P.S. How can I prevent the lines between my < code > and < /code > tags from wrapping prematurely?