my @AoA; while () { push @AoA, [split]; } use Data::Dump; dd \@AoA; __DATA__ First line of the file. Second line of the file. Third line of the file. Fourth line of the file. Fifth line of the file. Sixth line of the file.