Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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 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 given is experimental at line 10. when is experimental at 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

In reply to Re^4: Experimental warnings with given/when by Bod
in thread Experimental warnings with given/when by Bod

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

  • 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.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-06-27 06:18 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (86 votes). Check out past polls.