http://www.perlmonks.org?node_id=927941


in reply to Can't start threads inside a BEGIN{} block

Move the $num_threads/$thr in side the begin and it will work!