#!/usr/bin/perl -w use threads; while (1) { sleep 2; my $thread = threads->new( sub { print "foo"; sleep 1; print "\n" }); $thread->detach; }