... 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; }