#! /usr/bin/perl use strict ; use warnings ; use MIME::Lite ; use Net::Ping::External qw/ ping / ; # Ping all the IP addresses. my $output = '' ; while ( ) { chomp ; next unless $_ ; $output .= "$_: " . ( ping( host => $_ ) ? 'OK' : 'FAILED' ) . "\n" ; } # Compose & send the email. my $msg = MIME::Lite->new( From => 'somemail@example.com', To => 'yourmail@example.com', Subject => 'Ping Report', Data => $output ) ; $msg->send ; __DATA__ 888.333.333.33 156.343.333.99 888.323.222.223 888.222.222.111