From: "Luca (Email)" Date: 2011-12-29T15:49:58+09:00 Subject: I: search through a csv file -----Messaggio originale----- Da: Aksh Akku [mailto:akshathakshu@gmail.com] Inviato: marted́ 15 novembre 2011 09:10 A: ruby-talk ML Oggetto: search through a csv file i have a person details csv file. I am trying to write a code to search for a particular person based on his first and last name. I wrote the code to search for single value but i am not sure how to search through a table with multiple keys. My code is: def load_xvid_file("person.csv", "r") do |csv|) @firstnames = [] @lastnames = [] csv_file = CSV.read(person.csv) csv_contents.shift csv_contents.each do |row| @firstnames << row[0] end csv_contents.each do |row| @lastnames << row[1] end @firstnames.each { |f| f.downcase! } @lastnames.each { |l| l.downcase! } end def search_for_person(fname,lname) fname = fname.downcase lname = lname.downcase puts if @firstnames.include?(fname) if @lastnames.include?(lname) puts "#{fname} #{lname} found!" else puts "#{fname} #{lname} not found!" end prompt end this code doesn't work. can you help me debug this. Thank you loads in advance. Regards, Akshath -- 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: Conto Arancio al 4,20%. Zero spese e massima liberta', aprilo in due minuti! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid922&d)-12