From: "NAKAMURA, Hiroshi" Date: 2004-06-14T18:03:18+09:00 Subject: Re: How to read a .csv file into a 2D array? Hi, Todd Gardner wrote: > How can I read the following text from a .csv file into a 2D array? > > Is there a prewritten routine allowing me not to have to parse the file myself? With ruby/1.8.1; % ruby18 -rcsv -e 'p CSV.open("text.tsv", "r", ?\t).collect { |row| row.to_a }' With ruby/1.9; % ruby -rcsv -e 'p CSV.parse(File.read("text.tsv"), ?\t)' A method CSV#parse for parsing string at once (without stream reading) is recently added. I'll add to ruby/1.8.2. Regards, // NaHi