Hello V
create your log file when the script starts, like this
open(LOG,">>logfile.txt") or die;
print LOG "Log file opened\n";
close LOG;
Each time you want to log something, open the file (for append, like above), write to and close the file. Like this
open(LOG,">>logfile.txt") or die...