As direct answer, you should read file line by line, process them with Text::CSV
, push new values to arrays with each array corresponds to original column and then just output them with join
or like to get transposed representation of original. Disposing of each array right after join
will help with memory problem too.
Writing values to external files instead of array and joining them with OS facilities is another way around memory requirements.
You also should think about why you need this. Is there really no better way to solve real task at hand, since transposing just by itself serves no real purpose?
1
solved Need to transpose a LARGE csv file in perl [closed]