use threads; my $i=1; while($i<=50){ my $thr = threads->new(\&lwp); $thr->detach(); print $i++, "\n"; sleep(1); }; sleep(); sub lwp { sleep(60); print threads->tid." ended\n"; return 1; }