From: Ruy Diaz Date: 2007-05-02T07:42:46+09:00 Subject: Re: file & split How about this: i = 0 while line=file.gets tab=line.split c8=tab[7].to_f i = i + 1 end puts c8 / i -----Original Message----- From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of Marcin Kulisz Sent: May 1, 2007 3:33 PM To: ruby-talk ML Subject: Re: file & split Tim Hunter wrote: > a) It's "+=" not "=+" yep it's working better then before :-) > b) You probably need to convert c8 to a number before you can add it > puts sum += c8.to_i I've done it in this line "c8=tab[7].to_f" but I still don't know how to divide sum by amount of rows :-) eeeh it's a crazy work, and it's a bit late :-) -- Posted via http://www.ruby-forum.com/.