Possible Duplicate:
Best way to read CSV in Ruby. FasterCSV?
Is it possible to have Ruby read through a CSV file, line by line and use the contents of the line to set as different variables?
e.g. one line is Matt,Masters,18-04-1993
and I want to split the line and use:
- Matt = firstname
- Masters = surname
- 18-04-1993 = dob
so far I have:
require 'uri/http'
require 'csv'
File.open("filename.csv").readlines.each do |line|
d = line.split(",")
puts d
end