No, that's not it. Your problem has nothing to do with thread.
Use «use strict; use warnings;»!!! $num_threads is undef when you execute the BEGIN block.
In reply to Re^2: Can't start threads inside a BEGIN{} block
by ikegami
in thread Can't start threads inside a BEGIN{} block
by alain_desilets
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |