Script Required to Check a range of IP's
- From: syedmazhar.hasan@xxxxxxxxx (Mazhar)
- Date: Thu, 29 Jun 2006 19:44:18 +0400
Hi Folks,
I have a requirement of writing down a script to check the range of IP's in
a text file and display them which all are active and not active.
I have written down the below and needs your help because it is not giving
me the correct ouptut.
################################################################
#!/usr/bin/perl
use strict;
use warnings;
use Net::Ping;
my $file_name=$ARGV[0];
my $line;
my @host_array;
open(FILE,"$file_name") || die "Not been Accessed";
while (<FILE>) {
chomp;
@host_array=$_;
}
my $p = Net::Ping->new();
foreach my $host (@host_array)
{
print "$host is ";
print "NOT " unless $p->ping($host, 2);
print "reachable.\n";
sleep(1);
}
$p->close();
close (FILE);
###########################################################
Needs your help on the above
Regards
Mazhar
- Follow-Ups:
- RE: Script Required to Check a range of IP's
- From: Timothy Johnson
- Re: Script Required to Check a range of IP's
- From: DJ Stunks
- Re: Script Required to Check a range of IP's
- From: Mr. Shawn H. Corey
- Re: Script Required to Check a range of IP's
- From: Prabu
- Re: Script Required to Check a range of IP's
- From: Anthony Ettinger
- Re: Script Required to Check a range of IP's
- From: Joshua Colson
- RE: Script Required to Check a range of IP's
- Prev by Date: Re: Installation query
- Next by Date: Re: Script Required to Check a range of IP's
- Previous by thread: the FOR Loop in the English Language
- Next by thread: Re: Script Required to Check a range of IP's
- Index(es):
Relevant Pages
|