From: Li Chen Date: 2006-10-21T01:06:34+09:00 Subject: Re: problem with reading file > > You need to tell Ruby to coerce the strings into integers. > > array = [] > > File.open('array.text') do |file| > file.each_line do |line| > array << line.split[1].to_i > end > end > > array.each_slice(3) do |triplet| > average = (slice[0]+slice[1]+slice[2])/3.0 > puts average > end Thank you very much, Li -- Posted via http://www.ruby-forum.com/.