in reply to Re^4: how to log a process
in thread how to log a process

Yep! Right.
This an error before the other errors. The first "my $logmsg" is commented out. There is more than one problem in the code. Once poster gets to the: my $logmsg = $date/$dir/$file; it will be found that is a "division by zero error". I was just looking in web browser and not in my editor so didn't see the exact line.

I highly advise the op to not reuse $logmsg both as a file name and as a message text name.