in reply to Redirecting STDERR to a variable

The answers by people earlier only works if the perl script is trying to redirect its own output, not capturing stderr from another process.

To capture the STDERR from another program under DOS, try the open pipe:

use IO::File; my $f = new IO::File; $f->open("program 2>&1 1>NULL |") or die "Can not open stderr from ano +ther process."; while (<$f>) { ... do stuff }
Note that the redirection 2>&1 and 1>NULL works under DOS.