Craig Demyanovich wrote: > Something like this? > >>> h = Hash.new( [] ) > => {} >>> h["a"] << 2.2 > => [2.2] >>> h["a"] << 3 > => [2.2, 3] >>> sum_of_a = 0.0 > => 0.0 >>> h["a"].inject { |sum_of_a, value| sum_of_a += value } > => 5.2 >>> sum_of_a > => 5.2 > > I have no idea if that's the best way to do that; I'm still earning my > Ruby > chops. > > Regards, > Craig I'm pretty new to ruby as well. I have the following and its saying "can't conver float into a string". Keep in mind that the accounts and balances are stored in variables. class Info attr_reader :acct, :money def initialize(filename) @acct = File.new(filename, "r") end f = Info.new("SKTYFutBalances20080415.txt") act = f.acct act.each do |list| #covert me to a string futbal = list.to_s #Pull accounts office = futbal[21..23] if office == "RPT" next else @acctnum = futbal[24..28] end #Pull Liquidating values @lv = futbal[217..230] #Pull LV Indicator is_negative = futbal[215..215] == '-' value = @lv.to_f/100 value = -value if is_negative #puts @acctnum,value #test = @acctnum.to_sym sktylist = Hash.new("") sktylist[ @acctnum ] << value p sktylist end end -- Posted via http://www.ruby-forum.com/.