steve tran wrote:
Hello
I am a beginner to perl and I have a question
if I want to use system or open or backticks to
execute a system command,
like system("$cmd arg1"); ( with system for instance)
and the $cmd which is a prog takes another program
called in arg1 , and that program(arg1) requires
STDIN,
and I need to redirect the output from $cmd into a
file
how can I make both happen ?
if I do system("$cmd arg1");
I can see my program waiting for input in STDOUT,but I
cant capture the STDOUT to proces later but when I add
system("$cmd arg1 >> out");
the program waits but the output from arg1 goes to
out.
Is there an easy way to accomplish both.
I would really appreciate any help
steve
__________________________________
Yahoo! Mail for Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
Although the question isn't clear to me, I think you are looking for pipes ...
open (FD, "|command arg1");
print FD "text from STDIN goes here";
and if you want to capture the output from this program, you can use ...
open(FD, "command arg1|");
@buf = <FD>;
--
/binish/
|
- Re: System, shell question Binish A R
-