How09 has asked for the wisdom of the Perl Monks concerning the following question:
----- some output samples: ----- (linux-gnome terminal)#!/usr/bin/perl -wT use strict; use warnings; my $s1 = <STDIN>; print("\$s1= <$s1> \n"); if (<STDIN>) { my $s2 = <STDIN>; print("\$s2= <$s1> \n"); };
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.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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: read through \x0a in data piped via STDIN
by mr_mischief (Monsignor) on Dec 09, 2010 at 17:54 UTC | |
|
Re: read through \x0a in data piped via STDIN
by VinsWorldcom (Prior) on Dec 09, 2010 at 17:56 UTC | |
by How09 (Novice) on Dec 09, 2010 at 18:23 UTC | |
|
Re: read through \x0a in data piped via STDIN
by Anonyrnous Monk (Hermit) on Dec 09, 2010 at 17:54 UTC |