How can I put the result of <STDOUT> in a variable How can I put the result of <STDOUT> in a variable wysiwyg (Programmer) (OP) 18 May 00 11:37 Hi I'm new to perl and I like to know how to put the result of the command STDOUT in a variable. My needs are 1)to capture the output at the screen2)To put the output in a variablehere's a sample of my code:`xcom62 -cf RE: How can I put the result of <STDOUT> in a variable AndyBo (MIS) 19 May 00 07:14 First things first, STDOUT isn't a command, it's a pointer to an output stream. In perl these pointers are referred to as "filehandles". STDOUT is a special filehandle, in that it refers to the "standard output" stream. This is usually the screen.Although it's possible to redirect STDOUT, I tend to leave STDOUT alone and create my own filehandle if I need ot redirect output. For example, the following code prints a message to the file "message.out", overwriting it if it already exists.open (MYSTDOUT, ">message.out");print MYSTDOUT "My test message.\n";close (MYSTDOUT);The disadvantage with this approach is that you do not see the message on the screen. If you want to write a message to the screen and see it in the log file you could try the following:open (MYSTDOUT, "¦tee message.out");print MYSTDOUT "My test message.\n";close (MYSTDOUT);This opens a pipe to the Unix command "tee". "tee" will print the output to screen as well as sending it to the named file.If you want to put the output from your script into a variable, why not turn this on it's head a little? Put the message into a variable, and print the variable? For example:$My_Message = "My test message\n";open (MYSTDOUT, ">message.out");print MYSTDOUT $My_Message;close (MYSTDOUT);Hope this helps. RE: How can I put the result of <STDOUT> in a variable kaih (Programmer) 22 May 00 11:08 If I understand correctly you are running an external command "xcom62 -cf" in your perl program. You need to capture the output from this command, and put it in a variable.The trick is to use backtics, like in shell scripting. If you want everything in one string then use$str_var = `xcom62 -cf`;If you want an array with one line per entry then use@arr_var = `xcom62 -cf`;- Kai.