in reply to opening many files

I would make an ArrayOfArray to keep the results. I would make a loop to open each file, read it line by line, use column 1 as the index to the ArrayOfArray and push col3 onto the appropriate array specified by the array index and then loop to the next file. Once you are done, the ArrayOfArray can be printed to a new file.

What code have you written so far? What are the problems? A loop is the appropriate answer for repetitive operations like this. The data will fit into memory at once and only one file at a time needs to be open.

Update: I think something like this would work:

#!/usr/bin/perl -w use strict; use Data::Dumper; my $datafile1=<<END; 1 has 0.334 2 has 0.986 3 has 0.787 END my $datafile2=<<END; 1 has 0.894 2 has 0.586 3 has 0.187 END my @data; foreach my $fileRef (\$datafile1, \$datafile2) { open FILE, '<', $fileRef or die "$!"; while (<FILE>) { my ($row, $col3) = (split)[0,2]; push @{$data[--$row]}, $col3; } } my $row_num=1; foreach my $row (@data) { print $row_num++, " has ", "@$row\n"; } __END__ 1 has 0.334 0.894 2 has 0.986 0.586 3 has 0.787 0.187
Of course instead of using references to files, you would need to use some form of glob() or readdir() to get the file names. And of course the data that was presented is not a CSV file so, something would have to be done about that.