RE: Script Required to Check a range of IP's
- From: ryanfrantz@xxxxxxxxxxxxxxxx (Ryan Frantz)
- Date: Thu, 29 Jun 2006 12:34:02 -0400
-----Original Message-----
From: Mazhar [mailto:syedmazhar.hasan@xxxxxxxxx]
Sent: Thursday, June 29, 2006 11:44 AM
To: Perl Beginners
Subject: Script Required to Check a range of IP's
Hi Folks,
Howdy,
I have a requirement of writing down a script to check the range ofIP's
ingiving
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
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";
To be of more help, I'd suggest that you provide some example input. Is
there one address per line? Multiple addresses per line (delimited).
while (<FILE>) {
chomp;
@host_array=$_;
}
If we have some example input, then we can tell if the 'while' block is
kosher. If there are multiple IP addresses, then you'll want to 'push'
the addresses into @host_array.
ry
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: Mazhar
- Re: Script Required to Check a range of IP's
- Prev by Date: Re: Script Required to Check a range of IP's
- Next by Date: Re: Script Required to Check a range of IP's
- Previous by thread: Re: Script Required to Check a range of IP's
- Next by thread: Re: Script Required to Check a range of IP's
- Index(es):
Relevant Pages
|