From: Matthew Moss Date: 2006-03-28T09:38:38+09:00 Subject: Re: Would this be possible? I'm not sure how that would work.... you're re-reading the input stream twice. Anyway, here's my version. I could compact it more, but I won't try confusing you too much all at once. =) figures = STDIN.read.split("\n").map { |x| x.to_f } sum = figures.inject { |s, x| s + x } average = sum / figures.size high = figures.select { |x| x > average } puts "Average: #{average}" puts "Count greater than average: #{high.size}"