unix pipes to perl scripts
From: trt. (therealtroll_at_yahoo.com)
Date: 03/14/05
- Previous message: andreas gammel: "hash implementation or API for Visual C++ ?"
- Next in thread: Michael Abootorab: "Re: unix pipes to perl scripts"
- Reply: Michael Abootorab: "Re: unix pipes to perl scripts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Mar 2005 02:33:53 -0800
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
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 ( <ARGV> ) {
print "file: $_";
};
print "\ntype something : ";
$answer = <STDIN>;
print "you typed : $answer \n";
===code=============================
thanks!
- Previous message: andreas gammel: "hash implementation or API for Visual C++ ?"
- Next in thread: Michael Abootorab: "Re: unix pipes to perl scripts"
- Reply: Michael Abootorab: "Re: unix pipes to perl scripts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|