Hello, I am trying to read data piped to the program via stdin.
It seems that an \x0a in the data will end what is taken as "<STDIN>".
Other "control" characters will go into STDIN ok and the buffer behaves as expected.
----- small example code -----
#!/usr/bin/perl -wT use strict; use warnings; my $s1 = <STDIN>; print("\$s1= <$s1> \n"); if (<STDIN>) { my $s2 = <STDIN>; print("\$s2= <$s1> \n"); };
----- some output samples: ----- (linux-gnome terminal)
perl> echo -ne "hello\x0aWorld" | ./pipe_x-1.pl # try \n $s1= <hello > $s2= <hello: > perl> echo -ne "hello\x0dWorld" | ./pipe_x-1.pl # try \r World> ello perl> echo -ne "hello\x09World" | ./pipe_x-1.pl # try \t $s1= <hello World>
As you can see the samples using 0x0d and 0x09 are read through to EOF and buffer is empty so the $s2 print does not occur.

But something wierd happens with the 0x0a.
Very interesting , what can I do to read through that?

In reply to read through \x0a in data piped via STDIN by How09

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.