in reply to removing all threads..

You could add $_->join for threads::list(); just before the program ends; but it will require the threads to terminate before the program will end.

Alternatively, if you do not care to wait for the threads to complete; detach the threads, either when you create them:

threads->new( ... )->detach;

Or just before you exit the program:

$_->detach for threads::list(); sleep 1; exit;

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

RIP Neil Armstrong