From: Heesob Park Date: 2008-06-06T11:08:27+09:00 Subject: Re: Newbie question concerning ruby and mysql Hi, 2008/6/6 Michael Litchard : > Hi, I'm taking this flat file and putting it into a mysql table. > The question is, given the code I will be working from, what's the Ruby way > to skip the first line? > > > > Here's the code I'll be working from > > # prepare statement for use within insert loop > sth = dbh.prepare("INSERT INTO people (id, name, height) VALUES(?, ?, ?)") > > # read each line from file, split into values, and insert into database > File.open("people.txt", "r") do |f| > f.each_line do |line| next if f.lineno==1 > name, height = line.chomp.split("\t") > sth.execute(nil, name, height) > end > end > Regards, Park Heesob