"orbit" <orbit / klientsky.ru> schrieb im Newsbeitrag news:734420e9.0406010348.c89bb58 / posting.google.com... > orbit / klientsky.ru (orbit) wrote in message news:<734420e9.0405310551.2526ea0 / posting.google.com>... > > Whot can I set value for variable which name cosist ather variable? > > > > var1 = "@var2" > > I want, that as in Perl was > cat p1.pl > > #!/usr/bin/perl > > $foo = "xo-xo"; > print "1 - foo = $foo\n"; > $scalarref = \$foo; > $$scalarref = "xe-xe"; > print "2 - foo = $foo\n"; > > ./p1.pl > 1 - foo = xo-xo > 2 - foo = xe-xe That's not possible in Ruby in a similar way. You could do however: #!/usr/bin/ruby class Ref def initialize(var, env) var = var.to_s if Symbol === var @var, @env = var, env end def deref eval( @var, @env ) end def deref=(x) Thread.current[:x] = x begin eval( "#{@var}=Thread.current[:x]", @env ) ensure Thread.current[:x] = nil end end end foo = "xo-xo" puts "1 - foo = #{foo}" scalarref = Ref.new( :foo, binding ) scalarref.deref = "xe-xe" puts "2 - foo = #{foo}" But what do you need that for? I suspect you won't miss this perlism any more if you adjust more to the Ruby Way(TM). Regards robert