in reply to Robustly piping several processes.
type a.pl|perl -w a.pland it demonstrates how you can make your scripts to follow the behavior of tranditional pipe, and take output from another process as input.
Update 2: I don't know whether you have control towards cmd1, cmd2, etc. or not. If yes, I would strongly suggest you to use pipe(), to help you connect those handlers into pairs.a.pl: @in = <STDIN>; foreach (@in) { print "from perl script: ", $_; }
However I am wondering why you are trying to do that. It sounds to me, like you are reinventing something the OS is doing for you. For the project you are working on, is there an alternative solution, which allows you to utilize your OS as much as possible? Well, any way, I believe that you must have a good reason to do this.open(DATA, "<", "ex902.pl"); @in = <DATA>;#read in as array close(DATA); open(DATA1, ">", "data.txt"); print DATA1 @in;#flush the whole array out close(DATA1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Robustly piping several processes.
by BazB (Priest) on Dec 25, 2002 at 23:43 UTC | |
by pg (Canon) on Dec 26, 2002 at 02:54 UTC | |
by John M. Dlugosz (Monsignor) on Dec 26, 2002 at 03:53 UTC |