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.In my text file : ID dataR1 dataR2 dataR3 ... 1 324 445 654 2 234 654 768.5 3 542.12 764 98.2 . . .
Help appreciated :)for(my $i = 0; $i < $originalfilecount; $i++) { #read in the current file open CURINFILE, "<$files[$i]" or die "Error couldn't open file $fi +les[$i]\n"; print "$files[$i]\n"; while(<CURINFILE>) { chomp $_; my @columns = split('\t'); push(@ID, $columns[0]); push(@data1, $columns[1]); push(@data2, $columns[2]); push(@data3, $columns[3]); 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 +file"; print OUT1 "$data[1]" } close OUT1 }
In reply to How to add column into array from delimited tab file by hellohello1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |