http://qs321.pair.com?node_id=121846


in reply to Messin around with fork() and fd's

Redirecting a filehandle is easy especially if you don't care about restoring it later:

open STDOUT, ">>somelogfile" or die "opening logfile: $!\n"; open STDERR, ">&STDOUT" or die "dup'ing STDOUT to STDERR: $!\n";

Basically, this is the same as example of redirecting STDOUT and STDERR in the docs for open except you don't actually save the filehandles beforehand and restore them afterwards.