DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Perl: Redirect STDERR In A Script
Redirect STDERR to a file from within a script.
use IO::Handle; # Redirect the STDERR screen to a log file open EOUT, ">/path/to/log/file" or die $!; STDERR->fdopen(\*EOUT, "w") or die $!; # Redirect the STDOUT screen to a log file open SOUT, ">/path/to/log/file" or die $!; STDOUT->fdopen(\*SOUT, "w") or die $!; # Something useful here close EOUT; close SOUT; # End of program





