James Kipp <[EMAIL PROTECTED]> wrote: > Navid M. <[EMAIL PROTECTED]> writes: >> >> I was wondering if it's possible to save the error of >> a DOS command from the error stream into a variable. >> > you could try the old 2>&1 trick > $out = `$cmd 2>&1`; > > or use system() and read the docs for capturing error codes:
Assuming IPC::Open3 works on Windows [I believe that it does] you could also do: sub readpipes { require IPC::Open3; my $pid = IPC::Open3::open3(my ($in, $out, $err), @_); close $in; waitpid $pid, 0; [<$out>], [<$err>] } my ($out, $err) = readpipes qw(...); foreach (@$out) { print "out : $_" } foreach (@$err) { print "err : $_" } This can be easier to deal with, especially if the subprocess writes to both streams. -- Steve perldoc -qa.j | perl -lpe '($_)=m("(.*)")' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]