This script when set in crontab to run every 10 minutes (with the */10 for minutes) will write and append 10 pings to the file ping_results.txt putting a date stamp and the output of the ping.


#!/usr/bin/perl
########################################
# Simple script to run a ping test     #
# against a host every 10min, 10       #
# packets.  This will write to file    #
# ping_results.txt.        -lb         #
########################################
use warnings;
use strict;

my $host = "192.168.0.1";
my $file = "/temp-ping/ping_results.txt";
my $current_time = `date`;
my $ping;

open FILE, ">>$file";
$ping = `/bin/ping -s 800 -c 10 $host`;
print FILE "\n\nTime of ping : $current_time\n";
print FILE "*" x 50,"\n";
print FILE $ping;
print FILE "*" x 50,"\n";
close FILE;