use 5.014; use threads; use threads::shared; my $input : shared; my $inthread = threads->new (sub { $SIG{KILL} = sub { threads->exit(); }; print "Enter something: "; chomp ($input = ); }); sleep 5; if (not defined $input) { $inthread->kill('KILL')->detach; } else { print "we got $input!"; } my $message = 'HELLO FROM SUB!!!\n'; my ($excelthread) = threads->create('read_excel', $message); #read_excel($message); say "\nNEW THREAD SUCCESSFULLY CREATED"; sub read_excel{ say shift; }