From: Tim Wolak Date: 2008-05-13T23:48:44+09:00 Subject: hash merge I'm not sure if I'm using this the right way and I'm hoping you guys can help. I am merging two hashes together using merge and need to keep the keys the same and subtract the difference between the two values. The keys are account numbers and the values are the balances. Not sure why the balances are not subtracting and creating the new value. Thanks in advance. Tim class Calculate attr_reader :sktyfuta, :sktyfutb def initialize(sktyfuta, sktyfutb) @sktyfuta = sktyfuta @sktyfutb = sktyfutb end def data_comp @sktyfuta.merge(@sktyfutb) { |key, old_value, new_value| old_value - new_value } end end -- Posted via http://www.ruby-forum.com/.