I'm trying to pipe in text from a command on Windows; we'll call the command "mycmd". Some output lines from mycmd end in bold characters and no matter what I try perl completely ignores these lines. Binmode does not help.
> cmd > test_shell > perl my $res = `cmd`; open (TEST, ">test_perl1"); print TEST $res; close TEST; open (TEST, ">test_perl2"); open (CMD, "cmd |"); binmode CMD; #Tried with and without this. while (<CMD>) { print TEST "$_"; } close CMD; close TEST; #Let dos shell do io? The 'cmd /C' bit should be superfluous.(?) #End result is the same either way. `cmd /C "mycmd > test_perl3"`; EOF > wc -l test_shell test_perl1 test_perl2 test_perl3 111 test_shell 107 test_perl1 107 test_perl2 107 test_perl3
What the heck is going on here? How can Perl force the shell to throw away all lines with bold characters? I get the same results with both Perl 5.005 and Perl 5.8.8.

In reply to Perl ignores lines with bold characters from a pipe on Windows by kingkongrevenge

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.