... print "create thread\n"; my $run : shared = 1; $thread = threads->new( \<G::scanChange::monitor()); # \<G::scanChange::monitor); print "Waiting 5 seconds while the thread runs\n"; sleep 5; print "Shutting down\n"; $run = 0; $thread->join; } #### $thread = threads->new(\<G::scanChange::monitor()); #### sub test{ print 'Hello world' } print \&test; CODE(0x1bc2cdc) print \&test() Hello world SCALAR(0x1bc2d18) #### thread failed to start: Not a CODE reference at ... #### # Do some stuff $thread->new( ...); # start a thread sleep ...; # Sleep a while $thread->join; # Wait for the thread to finish. # do some other stuff.