my @matrix; my $row = 0; # count no. of lines open(DATA, "< data.txt"); my @lines = ; close(DATA); my $c = @lines; open(DATA, "< data.txt"); push @{$matrix[$row++]}, split while ; dd @matrix; &colprint(\@matrix); close(DATA); my @arrayOfninth_col; sub colprint { my $matrix_ref = shift; for (1 .. $c) { print "$matrix_ref->[$c-1][9] \n"; my $value = $matrix_ref->[$c-1][9]; push @arrayOfninth_col , $value; } # process the array @arrayOfninth_col for indexes }