my @aoa; # Array of arrays (2-d arrray) open my $CURINFILE, "<", $files[$i]" or die "Error couldn't open file $files[$i]\n"; print "$files[$i]\n"; while(<$CURINFILE>) { chomp $_; push @aoa, [ split('\t')]; # Insert an array ref into the array (which is what makes it 2-D) } close $CURINFILE; print "\nWriting output..."; #The first row of @aoa contains the titles, so skip that, and print the rest.... for my $row (@aoa[1..$#aoa]){ # That is a slice of the array, from index 1 till the end print $row->[0]."\n"; # $row->[0] contains the contents of the first column (ID) # Similarly, $row->[1] is the dataR1 column }