Are you sure?
I thought I was but I set up a little test to make sure I was sure and now I am not...
use feature "switch";
# Redirect STDERR
open my $err_fh, '>', 'stderr.log';
*STDERR = $err_fh;
# Redirect STDERR
open my $out_fh, '>', 'stdout.log';
*STDOUT = $out_fh;
my $i;
given($i) {
print "$i\n" when $i < 4;
}
# Prove STDERR is redirected
my $error = 10 / 0;
Illegal division by zero at test.pl line 15. is the only thing that is written to STDERR and 3 gets written to STDOUT but the following still gets displayed on the command prompt:
C:\Users\ian\Perl>perl test.pl
given is experimental at test.pl line 10.
when is experimental at test.pl line 11.
C:\Users\ian\Perl>
So I am not really sure what is going on with output streams as the warnings are on neither STDERR nor STDOUT.
This is using Perl v5.28.1
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link or
or How to display code and escape characters
are good places to start.
|