package test; require Exporter; our @ISA =qw(Exporter); our @EXPORT =qw(queuereader); ## You are exporting "queuereader" our @VERSION =1.0; sub forthread{ ## Not the forthread function that is in the file! my ($arg)=@_; return 0; } #forthread ## You have no module termination value, 1; #### use threads; use test; my $argument=1; ## VVVVVVVVVV---- this is not a function reference, its a string! my $thread=threads->create("forthread", ($argument)); $thread->join(); exit(0); #### ## test.pl use threads; use Testit; my $argument=1; my $thread=threads->create( 'forthread', ($argument)); $thread->join(); exit(0); ## Testit.pm package Testit; require Exporter; our @ISA =qw(Exporter); our @EXPORT =qw(forthread); our @VERSION =1.0; sub forthread{ my ($arg)=@_; warn "$arg"; return 0; } 1; #### C:\test>test.pl 1 at Testit.pm line 11. Attempt to free unreferenced scalar: SV 0x194aa50, Perl interpreter: 0x18290c4 during global destruction. #### use threads; use Testit; my $argument=1; my $thread=threads->create( \&forthread, ($argument)); $thread->join(); exit(0); __END__ C:\test>test.pl 1 at Testit.pm line 11.