From: Michael Fellinger Date: 2007-07-26T10:39:32+09:00 Subject: Re: How to properly iterate an array (using TDD) > Array.each returns self. Your function will have to store the results of the > split lengths somehow. > > Such as: > > def get_component_info(bom) > result = Array.new > bom.each { |line| > result << line.split("\t").length > } > result.join("\n") > end Make that: def get_component_info(bom) bom.map{|l| l.split("\t").size }.join("\n") end