in reply to how to detect background process completed or not

fork the new process on the perl side, instead of on the shell:
sub system_background { my $pid = fork; if(defined($pid) and $pid==0) { exec(@_); exit(1) } $pid } for (...) { my $child = system_background("perl test1.pl"); system "perl test2.pl"); ... my $result = waitpid($child, 0); }