I may be on completely the wrong track, but IIRC from my C days, 'typically' STDOUT is related intimately with file number 1 (STDIN being 0 and STDERR being 2). When you close and the reopen STDOUT, it does not get the lowest available file number but the next available, which is 3. I believe you have to do a dup call of STDIN to get the next lowest number (thus recreating fileno 1) and then manipulate that (via ioctl's) to recreate it as a clone of STDOUT. How this relates to Perl IO model I have no idea, but I see strong similiarities in the C API and Perl's support

I feel confident that errors in this assertion will be pointed out to me.

In reply to Re: How can I re-open STDOUT? by leriksen
in thread How can I re-open STDOUT? by Courage

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.