I'm working on a dice rolling program. Right now I'm storing user's
choices in a hash labeled 'dice_hash'. A user who has completed their
choices has effectively created a hash that looks like the following:

dice_hash{
  "four" => 2
  "six"  => 5
  "twenty" => 1
}

The key is the type of die, and the value is the number of dice selected
by the user. What I would like to do is create instance variable of the
type of die. While I know the following code to be incorrect, I think it
helps to explain what I'm trying to accomplish:

dice_hash.each_pair do |k, v|
  @"#{k}"_sided_die = v       #This line creates the instance variable
end

As always, any help would be greatly appreciated. Thanks!

~Mike V.

-- 
Posted via http://www.ruby-forum.com/.