> Hello, > > I was wondering if it's possible to save the error of > a DOS command from the error stream into a variable. > > For example, the STDOUT of a DOS command can be saved > to a variable this way: > > $var = `dir`; # Using back quotes > > but this won't save anything from STDERR.
you could try the old 2>&1 trick $out = `$cmd 2>&1`; or use system() and read the docs for capturing error codes: -- The return value is the exit status of the program as returned by the "wait" call. To get the actual exit value divide by 256. See also the exec entry elsewhere in this document. This is *not* what you want to use to capture the output from a command, for that you should use merely backticks or "qx//", as described in the section on "`STRING`" in the perlop manpage. Return value of -1 indicates a failure to start the program (inspect $! for the reason). -- example: system("blah blah"); my $err = $? >> 8; if ($err) { print "we got errors" } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]