Is this a simple case of me not knowing about a write output or seriously overlooking something blatant?

I was reading that use re 'debug'; is lexically scoped, but after redirecting both STDERR and STDOUT to a file, I still get output to on my console. The scope works properly (as I don't see output for the latter regex check on either STD* outputs or files), but why is there output from re 'debug' showing up on my console even with the redirects?

What output is the debug command outputting to that I don't know about?

#!/usr/bin/perl use warnings; use strict; my $string = 'd"alice'; { use re 'debug'; open STDERR, '>', 'err.txt' or die $!; open STDOUT, '>', 'out.txt' or die $!; $string =~ s/\bd\"//g; } $string =~ /alice/;

Output to the console from the code above:

$ ./bound.pl Compiling REx "\bd\%"" Final program: 1: BOUND (2) 2: EXACT <d"> (4) 4: END (0) anchored "d%"" at 0 (checking anchored) stclass BOUND minlen 2

Full output without redirects or scoping the use statement:

Compiling REx "\bd\%"" Final program: 1: BOUND (2) 2: EXACT <d"> (4) 4: END (0) anchored "d%"" at 0 (checking anchored) stclass BOUND minlen 2 Matching REx "\bd\%"" against "d%"alice" Intuit: trying to determine minimum start position... doing 'check' fbm scan, [0..7] gave 0 Found anchored substr "d%"" at offset 0 (rx_origin now 0)... (multiline anchor test skipped) looking for class: start_shift: 0 check_at: 0 rx_origin: 0 endpos: 1 Does not contradict STCLASS... Intuit: Successfully guessed: match at offset 0 0 <> <d"alice> | 1:BOUND(2) 0 <> <d"alice> | 2:EXACT <d">(4) 2 <d"> <alice> | 4:END(0) Match successful! Matching REx "\bd\%"" against "alice" Intuit: trying to determine minimum start position... doing 'check' fbm scan, [2..7] gave -1 Did not find anchored substr "d%""... Match rejected by optimizer Freeing REx: "\bd\%""

Why is the beginning part of the output being written to the console, and the rest stored in my redirected err.txt file?

On v5.22.0 fwiw

-stevieb


In reply to use re 'debug';, scope, and output by stevieb

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.