#! perl -sw use 5.010; use strict; our $FLAG; if( $FLAG ) { require '780835-s.pl'; doit(); } #### #! perl -sw use 5.010; use strict; use threads; sub t{ say 'Hi from thread'; } sub doit { say 'Before'; my $t = threads->create( \&t ); say 'After'; } 1; #### C:\test>780835-m -FLAG=0 C:\test>780835-m -FLAG=1 Before After Hi from thread Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached