steve tran wrote:
> Hello
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.
The same way that you would do it on the command line:
system( "$cmd < arg1 >> out" );
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>