Get both STDOUT and STDERR of a program or script to a variable in perl [duplicate]
问题 This question already has answers here : How can I get the CPU time for a perl system call? (3 answers) Closed 2 years ago . I did lot of google to redirect the both STDOUT and STDERR of a program to a variable in perl, Initially i tried using both open and backticks , but failed to capture Error signal to the variable. I am posting this question because Now I got the solution and hope it may helps others.. 回答1: To get both STDOUT and STDERR into a variable use following code snippet using