Do you care about the return value?
Do you need to send data to the child via its STDIN?
Do you need to collect data the child prints?
On what systems must this run?
| [reply] |
use threads;
use threads::shared;
...
my $Bresults:shared;
async {
$Bresults = `perl B.pl`;
}->detach;
my $Cresults = `perl C.pl`;
## Do something with the results;
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Hi, thanks for useful suggestion
I also need to call program D, but not untill both B and C have been executed.
Please guide.
| [reply] |
use threads;
use threads::shared;
...
my $Bresults:shared;
async {
$Bresults = `perl B.pl`;
}->detach;
my $Cresults = `perl C.pl`;
sleep 1 until defined $Bresults;
my $Dresults = `perl D.pl $Bresults $Cresults`;
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Take a look at fork.
Perl reduces RSI - it saves typing
| [reply] |
| [reply] [d/l] |
| [reply] [d/l] |
To add to the comments and advice of the greatly esteemed monks, ikegami, GrandFather, and BrowserUk, and while trying not to belabor the obvious, there may not be significant speedup if either B or C takes much more time than the other, e.g., if program B takes 20 seconds to run and program C takes 1, the savings by running B and C in parallel won't exceed 1 second. See also Amdahl's Law, which describes the speedup that can be expected by running processes in parallel.
Information about American English usage here and here. Floating point issues? Please read this before posting. — emc
| [reply] |