From: Siep Korteling Date: 2008-05-14T00:43:52+09:00 Subject: Re: hash merge Tim Wolak wrote: > Thanks for the post guys. My problem is this: > > a = { 54540 => 10345, 55550 => 30555 } > b = { 54540 => 11000, 55550 => 40556 } > > I need to merge these into one hash where the keys are the same so that > is fine, I need to subtract the values and the difference will be the > new key. Are you sure? I'll assume you meant value > > So I'm not sure this line is doing that I think it should do, I'm pretty > sure I may have the wrong syntax. > > @sktyfuta.merge(@sktyfutb) { |key, old_value, new_value| old_value - > new_value } > > Tim The syntax is fine,Yossef Mendelssohn actually used your class. See his example. How do you expect it to behave? regards, Siep -- Posted via http://www.ruby-forum.com/.