my @testarray; open(DATA, 'test.txt') or die $!; while() { chomp; #remove trailing \n push @testarray, [split ',', $_]; #[] makes anonymous # array with values from split, pushed on in order... # could use unshift if you wanted them reversed } close DATA;