use Net::Ping; my $adr = "192.168."; my @net = qw / 97. 100. 102. 104. 105. 32. 33. 34. /; my ($i, $j, $host); $p = Net::Ping->new() or die "Can't create ping object: $!\n"; for ($i=0; $i<=7; $i++) { HOST: for ($j=16; $j<=250; $j++) { $host = $adr . $net[$i] . $j; if (!$p->ping($host)) { print "$host not responding!\n"; next HOST; } else { print "$host\n"; } } }