From: moontoeki@... (Sung Moon) Date: 2002-02-08T03:04:00+09:00 Subject: Re: newbie: Array element conversion >Subject: newbie: Array element conversion >From: Mark Probert probertm@nortelnetworks.com >I have an array of numbers as strings that I want to >convert to individual numbers. > >Naively, I tried > > > a =["100", "487", >"23"] > > x, y,z = a.each { |s| s.to_i } > >but I only get the strings back. I know that a[0].to_i >works but I am not sure how to get it to work over >each element of the array, correctly. a =["100", "487", "23"] z = [] a.each { |s| s1 = s.to_i z << s1 } p z #==> {100, 487, 23]