while(1) { while (my $connection = $main->accept) { threads->create(\&initplayer,$connection); } #### sub initplayer { my $hand = shift; $hand->blocking(0); print "INITPLAYER CALLED!\n"; threads->detach; doplayer($hand,$hand,$hand); remove_player($hand); print "THREAD DESTROYED!\n"; $hand->close(); }