my @alltrans; chomp, push @alltrans, [ split /,/, $_, -1 ] for ; # or my @alltrans = map { chomp; [ split /,/, $_, -1 ] } ;