Perl: redirecting STDERR to STDOUT

I had occasion that I needed to redirect all STDERR output (die statements) to STDOUT. A webapp I wrote only looks at STDOUT, so this code causes STDERR to merge with STDOUT.

open(STDERR, ">&STDOUT");

Alternately you can also do it by reassigning the raw file handles:

*STDERR = *STDOUT;

You can get fancy and redirect all output to a log file:

open(LOG,">/tmp/foo.log");

*STDERR = *LOG;
*STDOUT = *LOG;


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.142.197.212
To prevent spam please submit by clicking the kitten: