Julian Fitzell wrote:

> var_name = "myVar"
> eval "#{var_name} = 10"
> myVar                      => 10
> 
> 
> Julian
> 
> On 20/10/2001 at 1:25 AM Andrew Cowan wrote:
> 
>>I am somewhat new to Ruby, coming from about 10 years of Perl
>>programming,
>>6 professionally.
>>
>>In perl, it is easy to create new variables with variable names that are
>>defined in another variable. For example:
>>
>>$var_name = "myVar";
>>${"$var_name"} = 10;
>>
>>would define a new variable $myVar the value 10.
>>
>>Is there a way to do this in Ruby? I suspect there must be but haven't
>>been
>>able to figure this out yet.
>>
>>Thanks for any help you can offer!
>>
>>Andy
>>

This looks great, thank you Julian!


______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With NINE Servers In California And Texas - The Worlds Uncensored News Source