From: cremes.devlist@... Date: 2006-02-24T11:52:53+09:00 Subject: Re: Nuby - help with Ruby object references On Feb 23, 2006, at 7:58 PM, Eero Saynatkari wrote: > unknown wrote: >> >> >> I appreciate any and all insight. >> >> cr >> >> --- code here --- >> >> #!/usr/bin/env ruby >> >> require 'find' >> >> h = Hash.new { |h,k| h[k] = [] } >> duplicates = Hash.new { |h,k| h[k] = [] } > > I am pretty sure this is where the problem is. Blocks > are closures so the 'h' in the second block refers to > the first Hash. Just change the first variable name > from 'h' to 'hash' in the whole file (it is a bit > clearer anyway) and you should be OK. Okay, I did as you suggested and it works now. But... I thought the scoping rules were different. I just checked pages 105 and 106 in the Pickaxe book to confirm the rules and they match up with what you said. I'm clear on this now. Thanks very much... cr