http://www.perlmonks.org?node_id=123094

chaoticset has asked for the wisdom of the Perl Monks concerning the following question:

Okay, that's a shameless attempt to tie this post to those stupid 'gone wild' videos. But, seriously, this has to do with bad file descriptors.

In my CGI script, I open a couple different files a couple different ways, and I created subroutines for these openings and closings.

This code:

sub stock_close { close(STOCK) || die "Error Closing Stock File: $!\n"; }

produces this output at the end of all the HTML that pops out:

Error Closing Stock File: Bad file descriptor

I already looked at this but it doesn't seem to be the same problem, because I'm not trying to open a directory.

I'm pretty much just confused about this. Am I opening the file incorrectly somehow?

Thank you for your time in advance.

-----------------------
You are what you think.

Update: Found my error. I had closed STOCK twice. I didn't really know what could produce that error.

Edited 2001-12-06 by dvergin to add update per user request</link>