open(FIL,">>$myfil") || die "No open for ct tot: $! \n"; if($ct == 1) { print FIL "\n$ct is down at this time.\n"; } elsif($ct >= 2) { print FIL "\n$ct are not available at this time.\n"; } system("mailx -s 'Mail header' myemail < $myfil"); close(FIL);