From: pjb@... (Pascal J. Bourguignon) Date: 2009-02-16T21:30:03+09:00 Subject: Re: Hash :: Recursive traversing and stripping the values vimal writes: > Hi, > I am a Ruby Newbie. > > I wrote a function for stripping all the values(a recursive one if > it is a nested hash) but i almost end up in an > error suggesting "Error => in `strip_hash_values': stack level too > deep (SystemStackError)". > Can someone help me with this. Perhaps a circular data structure is the problem: irb(main):001:0> h = Hash.new {} irb(main):002:0> h[:ha]=Hash.new {} irb(main):003:0> h[:ha][:ho]=h {:ha=>{:ho=>{...}}} irb(main):004:0> h {:ha=>{:ho=>{...}}} irb(main):005:0> h[:ha][:ho][:ha] {:ho=>{:ha=>{...}}} irb(main):006:0> h[:ha][:ho][:ha][:ho] {:ha=>{:ho=>{...}}} irb(main):007:0> -- __Pascal Bourguignon__