#!/usr/local/bin/perl -w use Net::Ping; #use Net::SMTP; sub email() { print "emailed: $_\n"; print eFILE ("$_\n"); } open(INFILE, "<", "host.file") or die("unable to open file: $!"); my @ip_array = ; chomp(@ip_array); open(OUTFILE, ">", "output.file") or die("unable to write to file: $!"); open(eFILE, "+<", "email.file") or die("unable to write to file: $!"); my @efile = ; chomp(@efile); $p = Net::Ping->new(); foreach (@ip_array) { if($p->ping($_)) { print OUTFILE ("$_ is responding to ping.\n"); }else{ print OUTFILE ("$_ is NOT responding to ping.\n"); #while (@efile = ) { #if (@efile =~ $_) { #print "found $_ on the list.\n" #}else{ email() #} #} } } close(INFILE); close(OUTFILE); close(eFILE);