use threads (); sub foo {1} threads->new( sub {print "thread: coderef = ".\&foo."\n"} )->join; print " main: coderef = ".\&foo."\n";