There is always the canonical:

open(STDERR, ">&STDOUT");
Which merely says to send STDERR's output to wherever STDOUT was going (i.e. the screen or the browser). The example jcwren gave pretty much does the same thing as well: this is a case where it is pretty safe to reassign the whole typeglob, because most coders are not going to be using something like @STDERR or even $STDERR. If you are, stop it right now! :) Save it for an obfuscated code entry.

If this is for a cgi script, as is often the case with this question, a better thing than redirecting to STDOUT (in my opinion) is to send it to a file:

open(STDERR, ">/home/AM/stderr.out");

That way, you avoid "mixing" the outout of STDOUT and STDERR. The two are usually quite distinguishable, but when it gets stuck in the middle of some HMTL, all bets are off. :)


In reply to Re: Getting STDERR to write to STDOUT? by turnstep
in thread Getting STDERR to write to STDOUT? by Pearte

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.