my $logfile = 'path/to/logfile.txt'; open(LOG, "> $logfile") or die "could not open log-file: $!"; print LOG "this is a log entry\n";