I stumbled over a bizarre effect in ActiveState Perl for Windows (in both the version 5.8.7 and 5.10.0), which can be shown as follows:

Consider I have a harmless program cat.pl, which just echoes its STDIN:

# This is cat.pl while(<>) { print; }
And then I have a marginally more harmful program ls.pl, which feeds some input to cat.pl and reads its output:
# This is ls.pl use strict; use warnings; use IPC::Open2; # $^X is the path to my Perl open2(*OUTPUT,*INPUT,"$^X", "cat.pl") or die "$!"; print INPUT "first line\nsecond line\n"; close INPUT; my @result=<OUTPUT>; close OUTPUT; print "RESULT:\n@result\n";
When I execute under Solaris or under Cygwin
perl ls.pl
I get as output
RESULT: first line second line
But when I do it under Windows, the program hangs, as if it would wait indefinitely for input.

I have no explanation for this odditiy. The only hint, that even under Solaris, respectively Cygwin, something unusual is going on, is the fact that in the (otherwise correct) output, the last line is preceded by a single space.

Any suggestion on what is going on here, and how I could get it running on Windows?
-- 
Ronald Fischer <ynnor@mm.st>

In reply to ActiveState woes : Is it EOF-blind? by rovf

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.