creating thread in PERL

  • Thread starter janicehwang1325
  • Start date
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?
 
J

janicehwang1325

erm.. i din really get your reply. However, i do solve the problem by
just reinstall Perl on FreeBSD.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top