in reply to How do I process multiple files in parallel?
I would implement this as follows:
First read all the filenames into an array, say @files.
Next loop over the filenames: for each file create a string of form "x1 y1 z1" corresponding to the 3 values in that file (you could also use an array or hash, but a string will work; you can use matching to collect the values subject to the comments already made in a previous reply.)
Save this string as an element of a global array, say @data.
Finally, open your output file and print out the results from @data.
(In your posted code, the opened file TEST doesn't seem to be used...maybe some of your code didn't display properly...)
The actual code should be straightforward to write.
chas