#!/usr/bin/perl use strict; use warnings; $address = 'user@gmail.com'; my @hostname = ("hostname -s"); my @email = ("echo $hostname array issue | mail -s 'Array problem' $address"); my @args = ("cciss_vol_status /dev/ciss0 > checkstatres.txt"); system(@args); open RESULTS, "checkstatres.txt" or die "can't open datafile: $!\n"; while (){ my @F=split(/:/, $_); if ( $F[2] =~ /OK./){ ;; } else{ my $hostname = system(@hostname); system(@email); } } my @args2 = ("rm checkstatres.txt"); system(@args2);