Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: WHy error message is printed in STDOUT?

by Albannach (Prior)
on Apr 12, 2006 at 14:05 UTC ( #542845=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://542845]
help
Chatterbox?
[Discipulus]: my backpack is ready for two nights in the mountains!
[Corion]: Discipulus: In the mountains during winter?
[choroba]: SHAttered
[Discipulus]: yes but in a little house with fireplace; 2 friends and lot of beverages..
[Corion]: Discipulus: Aah, so it's not really walking through quick-changing weather

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2017-02-24 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (353 votes). Check out past polls.