in reply to Automatic trace statements in program
open(LOG,">>logfile.log") || die "can't open file: $!\n" select LOG; print "$time batch job completed normally\n"; close(LOG) || die "LOG didn't close: $!\n";
A few things to note:
the >> in open refer to opening the file for append, if you want to destroy the file during each execution use a single >
select followed by a FILEHANDLE sets all commands that normally directed towards STDIN (print, printf write etc..) to point towards the specified FILEHANDLE.
One other note it is important to error check opening and closing of files, if the file didn't close properly you would want to know before your HD filled up.