J
janicehwang1325
hi experts,
my code is as simple as the follow.
use Thread;
$thr = new Thread \&sub1; # Spawn the thread
$thr->detach; # Now we officially don't care any more
sub sub1 {
$a = 0;
while (1) {
$a++;
print "\$a is $a\n";
sleep 1;
}
}
however, when i compile it. The error occur stating "Undefined
subroutine &threads::new called at sample_thread.pl line 2.". What is
the reason?
my code is as simple as the follow.
use Thread;
$thr = new Thread \&sub1; # Spawn the thread
$thr->detach; # Now we officially don't care any more
sub sub1 {
$a = 0;
while (1) {
$a++;
print "\$a is $a\n";
sleep 1;
}
}
however, when i compile it. The error occur stating "Undefined
subroutine &threads::new called at sample_thread.pl line 2.". What is
the reason?