From: Stefan Mahlitz Date: 2007-07-03T01:55:23+09:00 Subject: Re: Newbie: fastcsv: Read rows, print rows drubdrub@gmail.com wrote: > Thanks for such a rapid, patient response! > > You certainly helped me get "unstuck". Appreciate the references. I > had found the doc pages but was still laboring. > > For the record, here is my working code. No rocket science, but may > be useful to someone. > > All the best! > > > require 'rubygems' > require 'fastercsv' > > infile = "infile2.csv" > > FasterCSV.open(infile, "r") do |row| > row.each{|row| puts "row: #{row.inspect}"} > end > code> Just be aware about the fact that row is changed after row.each > irb(main):001:0> a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] > => [[1, 2, 3], [4, 5, 6], [7, 8, 9]] > irb(main):002:0> a.each do |row| > irb(main):003:1* row.each {|row| p row} > irb(main):004:1> p row > irb(main):005:1> end > 1 > 2 > 3 > 3 > 4 > 5 > 6 > 6 > 7 > 8 > 9 > 9 > => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]