Setting dynamic variables

How do I set variables dynamically based on a search in the
database? I have a list of 30 words in a table called 'words' with a field called...words. I would like to loop through them and for each word
set a variable. But I'm not sure how to do that. I've tried this but get
an error:

Well there's instance_variable_set, but this doesn't sound like a good
idea. What if the work isn't a legal variable name (eg if it has a
hyphen). What if the word is the same as some pre-existing instance
variable ? This also makes it hard to iterate over all the instance
variables set in this way. You'd be far better off bunging all that
data in a hash

Fred