use strict; use warnings; use threads; my $thread_sleep = "50"; my $thread_count = "0"; for (1..5000) { threads->new(\&handle_thread,++$thread_count); } sleep 10; print "--Parent Quits --"; ###################### sub handle_thread { my $thread_count = shift; threads->self->detach; # so long parent print "You are thread number $thread_count \n"; sleep $thread_sleep; }