in reply to Cleaner redirection of STDERR
You could reverse the logic of your sub:
if ($file) { open LOGFILE, ">>$file" or die "Error message: $!\n"; } else { open LOGFILE, ">&STDERR" or die "Another error\n"; } print LOGFILE "blah blah"; close LOGFILE or die "Yet another error\n";
-- TMTOWTDI
|
|---|