in reply to read through \x0a in data piped via STDIN
You're not reading to EOF.
This:
my $s1 = <STDIN>;
reads exactly one line. Since $/ is "\n" (see perlvar), your line ends at "\n".
If you want to read by line and get more than one line, I suggest some sort of iteration. Perhaps a while loop.
The most common idiom for reading a whole file line by line in Perl is:
while ( <$filehandle> ) { # do something }
In your case, that'd be:
while ( <STDIN> ) { # do something }
There's really nothing mysterious going on. All of this is well-documented and widely known.
|
|---|