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;