T
trt.
Got a problem piping command output to a perl script, in the test below
the loop accepts the piped files but it also interferes with my STDIN!
===test=============================
$ls -1 *.cfg | ./pp
file: hosts.cfg
file: pseries.cfg
type something : you typed :
===test=============================
I do not get the chance to type something in after "type something"...
Do i have to flush some variable inbetween the foreach loop and
<STDIN>?
Is looping trough <ARGV> or <> the best way to catch piped input?
===code=============================
$cat ./pp
#!/usr/bin/perl
while ( <> ) {
print "file: $_";
};
print "\ntype something : ";
$answer = <STDIN>;
print "you typed : $answer \n";
===code=============================
nb: also tried open FH, "-|" ... close FH, no difference.
thanks!
the loop accepts the piped files but it also interferes with my STDIN!
===test=============================
$ls -1 *.cfg | ./pp
file: hosts.cfg
file: pseries.cfg
type something : you typed :
===test=============================
I do not get the chance to type something in after "type something"...
Do i have to flush some variable inbetween the foreach loop and
<STDIN>?
Is looping trough <ARGV> or <> the best way to catch piped input?
===code=============================
$cat ./pp
#!/usr/bin/perl
while ( <> ) {
print "file: $_";
};
print "\ntype something : ";
$answer = <STDIN>;
print "you typed : $answer \n";
===code=============================
nb: also tried open FH, "-|" ... close FH, no difference.
thanks!