http://www.perlmonks.org?node_id=542845


in reply to WHy error message is printed in STDOUT?

Just to combine the above correct answers into a working solution which does work under Windows (I used del for simplicity but the effect is the same):
$cmd = 'del nonexistent.file'; chomp($res = `$cmd 2>&1`); print "\n[Command is :: ", $cmd, "]\n[RESULT:: ", $res,"]\n\n";

Which prints:

[Command is :: del nonexistent.file] [RESULT:: Could Not Find C:\My Documents\foo\Perl\dl\debug\nonexistent +.file]

--
I'd like to be able to assign to an luser