From: ara.t.howard@... Date: 2006-07-08T23:15:30+09:00 Subject: Re: storing and using references to variables On Sat, 8 Jul 2006, Russell Fulton wrote: > Hi, > I want to store a reference to a scalar variable (in perl parlance) > in another variable and then assign a value to the stored variable. I > have done this for contiainers by simply assigning the container to the > variable: > > ref = a = [] > > ref[0] = 'x' > > leaves a[0] == 'x' > > as it should. > > I want to be able to do something similar but using a simple variable > instead of an array. E.g. in perl > > $ref = \$a > > $$ref = 'x' > > but I can not find anything about explicitly dereferencing a variable. > > what I have done in the mean time is to use an array and only use the > first element. > > Cheers, Russell why wouldn't use simply use an object? class Container attr_accessor 'x' end c = Container.new c.x = 42 p c.x #=> 42 ?? -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama