# no need to close STDERR or STDOUT first; reopening will do that implicitly open STDERR, '>>', $logpath.'/'.$logfile or die "redirect STDERR >> $logpath/$logfile: $!"; $| = 1; open STDOUT, '>>&=', \*STDERR or die "redirect STDOUT -> STDERR: $!"; $| = 1; print "\n\n", '-' x 45, "\n";