I have a tab delimited file where I want to split each column into array so that I can calculate the individual values of the column. I'm new to perl so I hope for some guidance.
In my text file :
ID dataR1 dataR2 dataR3 ...
1 324 445 654
2 234 654 768.5
3 542.12 764 98.2
Right now, my code only can print out one value (dataR1) in OUT1. How do I actually put the whole values of dataR1 into the array to print out in OUT1?
In addition, how do I use for loop to actually loop from dataR1 to dataR3 to put into different arrays instead of having to type out manually as different files has different number of dataRx.
for(my $i = 0; $i < $originalfilecount; $i++)
#read in the current file
open CURINFILE, "<$files[$i]" or die "Error couldn't open file $fi
my @columns = split('\t');
print "\nWriting output...";
mkdir "$pathname" or die "Error couldn't create new Directory";
open OUT1, ">$pathname/column.txt" or die "error couldn't open output
print OUT1 "$data"
Help appreciated :)