in reply to dynamically creating variables
Why do you need to create new variables? They already appear to be in a hash, which is the data structure that is usually suggested when someone says they want variables with particular names. Perhaps I'm missing something.
Incidently, you're getting that error because you are trying to dereference a string (${$config} becomes ${ 'db' }, not the variable $db).
You can do what you're asking but it requires using soft (aka symbolic) references (perlref), which is usually a Bad Thing. See also Why it's stupid to use a variable as a variable name.
Update: added link to perlref
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: dynamically creating variables
by Anonymous Monk on Nov 02, 2006 at 08:15 UTC |