in reply to perl ithreads join help!!

Here is some working Win32 thread code that you can start from:
use strict; use threads; my @MyThread; my $threadcount = 15; for (0..($threadcount-1)){ $MyThread[$_]=threads->new(\&s,$_,10+$_); }; if ($ARGV[0] eq 'a'){ foreach (@MyThread){ print qq(Return check via thread array from ) . $_->join() . qq(\n +); } }else{ foreach (threads->list()){ print qq(Return check via threads list from ) . $_->join() . qq(\n +); } } ####################### sub s{ my $a=shift; sleep($threadcount-$a); print qq(In sub s param=$a\n); return shift() }
ANd some code that does something semi-useful with threads ..
use strict; use threads; use Thread::Queue; use Net::Ping; my $ThreadCount = 12; my @Threads; my $ServerQueue = Thread::Queue->new; my $ResultQ = Thread::Queue->new; my @Servers; # Replace the 4.2.2 with your subnet ... push @Servers, qq(4.2.2.$_) for (1..254); foreach my $Item (@Servers) { $ServerQueue->enqueue($Item); } for (1..$ThreadCount) { my $Thread = threads->new(\&Process, $ServerQueue); push (@Threads, $Thread); } foreach my $Thread (@Threads) { $Thread->join(); } print "\n--results---\n"; while (my $target = $ResultQ->dequeue_nb){ print " $target\n"; } ##################################### sub Process { my $ServerQueue = shift; my $pingobj = Net::Ping->new("icmp",5,100); while (my $Server = $ServerQueue->dequeue_nb()) { if ($pingobj->ping($Server)) { #ping was good $ResultQ->enqueue ($Server); threads->yield(); } else { #ping was bad } } }

Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarntees offense.