how to use open with many input streams and capture output?

P

Pawel Banys

Hello,

There is an operation which can be performed at the shell prompt the
following way:

some_prg [some_inputfile_1] [some_inputfile_2] > result_file

However, before "some_prg" can use files, they have to be converted and it
can be done like this:

some_prg <(convert inputfile_1) <(convert inputfile_2) > result_file

It works perfectly at shell prompt.

I would like to start the above sequence in perl script using "open"
command:

open(SOME_OUTPUT,"some_prg <(convert inputfile_1) <(convert inputfile_2) |
");

When I try to run the script and capture SOME_OUTPUT, I get the following
error:

sh: -c: line 1: syntax error near unexpected token `('
sh: -c: line 1: `some_prg <(convert file_1) <(convert file_2)'

Is there any way to solve that syntax error without writing extra shell
scripts as I would like to have all the code in a single perl script?

Thank you for any help.

Pawel Banys
 
J

Joe Smith

Pawel said:
some_prg <(convert inputfile_1) <(convert inputfile_2) > result_file

It works perfectly at shell prompt.

Which shell? That syntax is not valid for the /bin/sh (Bourne) shell,
which is what perl calls upon. For the Bourne shell, try this:

(convert inputfile_1; convert inputfile_2) | some_prog > result_file.

-Joe

P.S. Next time post to comp.lang.perl.misc, not comp.lang.perl .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top