in reply to defunct process are WAY beyond my experienc

The script kicks off a bunch of child processes.

Hi, I think you are confusing defunct processes with threads. When using threads, the spawned threads can either be joined or detached. If you detach it, it dosn't need to be joined, it will cease when the code block ends. When the parent thread exits, it will take all child threads with it, and issue a warning that some child threads were running at exit.

As usual, you should should make a complete self-contained running example. Here are a few to show the difference between detach and join.:

#!/usr/bin/perl use strict; use warnings; use threads; foreach (0..100){ # create a thread to call the "run_system" subroutine # to run "ls -la" on the OS my $thread = threads->create("run_system", "ls -la"); $thread->detach; } sub run_system{ my $cmd = shift; system($cmd); } __END__ #1liner perl -Mthreads=async -le"async{ system 'dir'; } for 1 .. 100"
Joining is a bit different.
#!/usr/bin/perl use warnings; use strict; use threads; # join() does three things: it waits for a thread to exit, # cleans up after it, and returns any data the thread may # have produced. my $thr1 = threads->new(\&sub1); my $ReturnData1 = $thr1->join; print "Thread1 returned @$ReturnData1\n"; my $thr2 = threads->new(\&sub2); my $ReturnData2 = $thr2->join; print "Thread2 returned @$ReturnData2\n"; my $thr3 = threads->new(\&sub3); my $ReturnData3 = $thr3->join; print "Thread3 returned @$ReturnData3\n"; sub sub1 { print "In thread1.....\n"; sleep 5; my @values = ('1a','1b', '1c'); return \@values; } sub sub2 { print "In thread2.....\n"; sleep 5; my @values = ('2a','2b', '2c'); return \@values; } sub sub3 { print "In thread3.....\n"; sleep 5; my @values = ('3a','3b', '3c'); return \@values; }

I'm not really a human, but I play one on earth. ..... an animated JAPH