You don't need 2 join subs. As you can see, all threads are in
main's thread->list. You probably should 'use warnings' and 'use strict' too, it will help you keep from confusing variables.
my @list = threads->list;
print scalar(@list),"\n";
foreach my $thr ( threads->list ) {
$thr->join;
}