in reply to Re: Running perl scripts in parallel
in thread Running perl scripts in parallel

I have tried this but it still won't let me continue my original script i.e. in pseudo code:
script1.pl ------------------------- call listener script2.pl #runs forever and outputs stuff call listener script3.pl #runs forever and outputs stuff die "Done script 1";

I tried your method butb script1.pl still wouldn't die. It is stuck at calling the listeners Thanks

Replies are listed 'Best First'.
Re^3: Running perl scripts in parallel
by kennethk (Abbot) on Jul 23, 2014 at 16:31 UTC
    Are you sure? If I'm understanding your comment, the only scenario where this should be true is if your fork is failing. What happens when you run this code:
    use strict; use warnings; my $pid = fork(); die "Fork failed" if not defined $pid; if ($pid) { #parent print "Parent output\n"; } else { #child exec q|perl -e 'sleep(1); print "Child output\n"'|; } wait; print "Parent finishing\n";

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Actually, it's my bad ! it actually worked :) Thank u tons!