END { ### This will get the Duration from the starting Execution time # till the time the process was stopped... $DURATION = duration(time() - $^T); my $duration_str = "*The myScriptname Daemon ran for $DURATION\n"; push @data, $duration_str; ### Close the LOG_FILE by untie'ing the array @data from the file: untie @data; ### PID File: Name and Location... my $PID_FILE = "/var/run/myScriptname.pid"; ### If the PID file exists, then we will remove it: if (-e $PID_FILE) { unlink $PID_FILE; #-->Deletes files from the given list... } }