From: Joel VanderWerf Date: 2003-04-24T14:58:17+09:00 Subject: Re: parsing large file into matrix Qubert wrote: > Is there a Ruby-way of creating an m by n array from the beginning? > I know the following doesn't work but something like it code would be nice: > x = File.open("file.txt").readlines.split('\t') How about this? x = File.open("file.txt").readlines. map {|line| line.chomp.split("\t"). map {|s|s.to_f}} Note that "\t" is necessary so that you get an actual tab char.