Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
## will count the number of ipadresses that will be scanned my $rjob; { my $hjobs = 0; my($i,$j,$k,$l); for ($l=1;$l<=1;$l++){ for ($i=1;$i<=1;$i++){ for ($j=1;$j<=1;$j++){ for ($k=1;$k<=255;$k++){ $hjobs++; }; }; }; }; $rjob=$hjobs; }; print "$rjob\n"; my $maxwork = $ARGV[3] || 50; { my $conter=0; my($i,$j,$k,$l); for ($l=1;$l<=1;$l++){ for ($i=1;$i<=1;$i++){ for ($j=1;$j<=1;$j++){ for ($k=1;$k<=255;$k++){ $conter++; $rjob--; print "$l.$i.$j.$k\n"; if ($rjob < $maxwork && $conter< $maxwork){ if ($rjob==0){ ### prints are for testing if the code worked, which did print "do the work $l.$i.$j.$k $conter $rjob\n"; }; }; if ($conter >= $maxwork){ #sleep 1; print "$l.$i.$j.$k $conter $rjob\n"; $conter=0; }; }; }; }; }; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: An efficient way to do this?
by BrowserUk (Patriarch) on Feb 06, 2008 at 12:44 UTC | |
|
Re: An efficient way to do this?
by andreas1234567 (Vicar) on Feb 06, 2008 at 13:40 UTC | |
|
Re: An efficient way to do this?
by jwkrahn (Abbot) on Feb 06, 2008 at 14:20 UTC | |
by locked_user sundialsvc4 (Abbot) on Feb 06, 2008 at 15:49 UTC |