my @_raa; while () { chomp; my @a=split(','); # use Text::CSV_XS here. push @{$_raa[$_]}, $a[$_] for 0..$#a; };