From: Austin Ziegler Date: 2008-01-22T21:50:49+09:00 Subject: Re: Hash two dimensions On Jan 22, 2008 7:42 AM, Mario Ruiz wrote: > Hi Everybody! > I'm doing this: > $Config=Hash.new(Hash.new()) > $Config["UNO"]["urlX"]="beep/UNO/playdoit.do" > $Config["UNO"]["urlY"]="beep/UNO/dontplayPP.do" > $Config["UNO"]["urlZ"]="beep/UNO/dontplay34jo.do" > $Config["DOS"]["urlX"]="beep/DOS/playad.do" > $Config["DOS"]["urlY"]="beep/DOS/dontplayf.do" > $Config["DOS"]["urlZ"]="beep/DOS/dontplay34aa.do" > $Config["TRES"]["urlX"]="beep/TRES/playcs.do" > $Config["TRES"]["urlY"]="beep/TRES/dontplayff.do" > $Config["TRES"]["urlZ"]="beep/TRES/dontplay34s.do" > > when I try to access to the value in $Config["UNO"]["urlY"] the result > is the value in $Config[TRES"]["urlY"] > > Why?? Because it's always the same hash. What you *want* is: $Config = Hash.new { |h, k| h[k] = Hash.new } -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca