-----Messaggio originale-----
Da: Darren H. [mailto:dhulem1 / umbc.edu] 
Inviato: venerd11 novembre 2011 02:24
A: ruby-talk ML
Oggetto: Reading CSV File

Hi all

I am new to ruby and need a little help for a project.

My code so far is...

require 'csv'
CSV.foreach("c:\plantproducts.csv") do |row| puts row.join(",") end

puts "enter Product ID Number"
product_id = gets.chomp
CSV.foreach("c:\plantproducts.csv") do |row| product_id == row[0] end


*In my csv file the columns go as follows Product id, name, price, type

my question is when the program is running and when you enter in your
product id number as it matches in the csv file (such as 1001 and the price
is 8.00) how do I get the other data from the csv file such as price so I
can later use it and show to the program user)

Thanks

--
Posted via http://www.ruby-forum.com/.


 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Capodanno al parco Oltremare Riccione: Pacchetto hotel 3 stelle in centro + ingresso al parco. 
* Mezza pensione, Internet gratis, animazione per bimbi. Scopri l'offerta!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid980&d)-12