Not Sure if it worked or not!

I modified the script to;
use strict; use Win32; use Win32::AdminMisc; use threads; use Thread::Queue; use Net::Ping; my $master = $$; my $verbose = $ARGV[0] eq q(-v); my $RequestQ = Thread::Queue->new; my $ResultQ = Thread::Queue->new; my $threadcount = 20; my @kids; my @targets; while (<DATA>) { chomp; print "$_ : "; my $ip_address = Win32::AdminMisc::gethostbyname($_); print "$ip_address\n"; push (@targets, $ip_address); } # Generate list of hosts to ping foreach my $target (@targets) { $RequestQ->enqueue ($target); } for (0..($threadcount - 1)){ $RequestQ->enqueue(undef); push @kids, threads->new(\&Ping_it, $_); } foreach (threads->list){ $_->join; } $ResultQ->enqueue(undef); # Last item while (my $target = $ResultQ->dequeue){ print " $target\n"; } ############################################# sub Ping_it{ my ($work_count, $miss_count); my $t = shift; my $pinger = Net::Ping->new('icmp', 1); while (my $target = $RequestQ->dequeue){ $work_count ++; my $retval = 0; $verbose and print "Child $target started\n"; if($pinger->ping($target)) { # PING! Throw it in the FIFO $verbose and print "Found $target!\n"; $retval=1 } else { warn "Thread $t $target: $!\n"; $verbose and print "No response from $target\n"; $retval=0; $miss_count++; } $ResultQ->enqueue ($target . "=" . $retval); threads->yield(); $verbose and print "Child $target exiting\n"; } $pinger->close(); $ResultQ->enqueue("Thread $t processed $work_count, missed $miss_co +unt"); } __DATA__ SN02GEY10a SN02GEZ10a SN02GFC09a SN02GEY09a SN02GEZ09a SN02GEY05a SN02GEY06a SN02GEY07a SN02GEY08a SN02GEZ05a SN02GEZ06a
And the output was;
C:\Perl>ping_sweep2.pl SN02GEY10a : 172.24.175.53 SN02GEZ10a : 172.24.166.15 SN02GFC09a : 172.24.184.43 SN02GEY09a : 172.24.184.21 SN02GEZ09a : 172.24.175.10 SN02GEY05a : 172.24.166.48 SN02GEY06a : 172.24.175.43 SN02GEY07a : 172.24.184.12 SN02GEY08a : 172.24.166.13 SN02GEZ05a : 172.24.175.55 SN02GEZ06a : 172.24.184.46 172.24.175.53=1 172.24.166.15=1 172.24.184.43=1 172.24.175.10=1 172.24.184.21=1 172.24.166.48=1 172.24.175.43=1 Thread 4 processed , missed 172.24.184.12=1 172.24.175.55=1 172.24.166.13=1 172.24.184.46=1 Thread 1 processed 3, missed Thread 2 processed 3, missed Thread 0 processed 3, missed Thread 3 processed 2, missed Thread 5 processed , missed Thread 6 processed , missed Thread 7 processed , missed Thread 8 processed , missed Thread 9 processed , missed Thread 10 processed , missed Thread 11 processed , missed Thread 12 processed , missed Thread 13 processed , missed Thread 14 processed , missed Thread 15 processed , missed Thread 16 processed , missed Thread 17 processed , missed Thread 18 processed , missed Thread 19 processed , missed
Do I have to convert the hostnames to IP address first?Any thoughts on how to get it working fully please?

Thanks
Blackadder

In reply to Re^2: Multi-threading ping of a list of hosts.....Again! by blackadder
in thread Multi-threading ping of a list of hosts.....Again! by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.