sub mylog { my $msg = shift; print LOGFILE $msg or die "Cannot write to logfile: $!"; }