Hello,

> Von: Ollivier C�dric 
> I have a problem with my program. I would like to do some 
> instructions in the same time by using thread.
> Why can I do for creating multithread in Perl ?
> That's my program.
> use threads;
> use Config;
>  
>       use Net::Ping;    
>     
>         $Config{useithreads} or die
>         "Recompilez Perl avec les threads activ�s pour faire 
> tourner ce programme.";
>     
>  sub subping { 
>   my ($c) = @_;
>      $p = Net::Ping->new();
>      if ($p->ping($c)) {
>       print "$host is alive.\n";
>       }
>      else { 
>       print "$host is not alive"; 
>       }
>      $p->close();
>      }   
>         
> for ($i=1;$i<255;$i++)
> { 
>      $host="10.10.10."."$i";
>      my $thread  = threads->create(threads,subping($host));
> }

here I would say, you should write:
my $thread1 = threads->new(\&subping, $host);

Gru� Alex

Reply via email to