open (LOGFILE, ">$logfile") or die "Can't open $logfile: $!";