From: jweirich@... Date: 2001-10-20T21:49:48+09:00 Subject: [ruby-talk:22826] Re: Creating variables with dynamic names ? >>>>> "Andrew" == Andrew Cowan writes: Andrew> I am somewhat new to Ruby, coming from about 10 years of Andrew> Perl programming, 6 professionally. Andrew> In perl, it is easy to create new variables with variable Andrew> names that are defined in another variable. For example: Andrew> $var_name = "myVar"; Andrew> ${"$var_name"} = 10; Andrew> would define a new variable $myVar the value 10. Andrew> Is there a way to do this in Ruby? I suspect there must be Andrew> but haven't been able to figure this out yet. Others have pointed out ways of doing this in Ruby. I thought I would mention that this is rather questionable practice to begin with (even in Perl). I think Mark-Jason Dominus explained it best in a three part article at ... http://perl.plover.com/varvarname.html -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)