#!/usr/bin/perl
my
$input
=
join
''
, <STDIN>;
unlink
'sendmail.log'
if
-f
'sendmail.log'
;
open
my
$fh
,
'>sendmail.log'
or
die
'Cannot write to sendmail.log'
;
$fh
"CLI args: @ARGV\n"
;
if
(
defined
$input
&&
length
$input
) {
$fh
"Executed with input on STDIN\n$input"
;
}
else
{
$fh
"Executed with no input on STDIN\n"
;
}