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>


In reply to Bad File Descriptors Gone Wild by chaoticset

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.