If you need to output a CSV file, I'd suggest using a module that writes CSV files, such as Text::CSV. As your data grows in complexity, this will scale easily without gotchas.
in reply to arrange output in columns
Please note that the number of files can be in 100's , so i cant simply use join function.
I don't follow why you can't populate an array (1 read per file) and then join the results and write them for your simple case. I'd think opening and reading from 100's of files simultaneously would represent a more significant technical challenge.
So what have you tried? What failed? We're happy to help debug, but we're not a code writing service.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.