use threads; use strict; use warnings; for (;;) { my $thr = threads->new($sub1)->join; undef $thr; }