|Do you know where your variables are?|
redirecting standard error with backticksby aardvark (Pilgrim)
|on May 16, 2001 at 07:15 UTC||Need Help??|
aardvark has asked for the
wisdom of the Perl Monks concerning the following question:
I've been banging my head against a wall trying to figure out a problem I first raised here. I have tried eval and some hairier possibilities, but nothing got me the errors/warnings coming from java command line tools like Xalan and FOP . Was it Java, Perl or me? Of course, it was stupid little me.
I figured it was time to take the dive (leap of faith?) into Interprocess Communications and follow tilly's advice. I settled in with dread and excitement to read Lincoln Stein's new book Network Programming with Perl. On page 43 my eyes popped out of my head, when I read, "On UNIX systems, you can use the Bourne shell's output redirection system to combine the subprocess's standard error with its standard output like this:
$ls_output = `ls 2>&1`;
I'm going to work on some applications with this and post them to the snippets section. Do you see any warning flags with this kind of solution? I'd also like to know if any of you have experience suggesting additions to the perldocs. If this gem had been there and in the right place(s) I would have saved hours of development time.
Get Strong Together!!
Edit: chipmunk 2001-05-15