$config{'db'}{'$key'} = $val;
should be
$config{'db'}{$key} = $val;
but I don't think that will fix your error. The error seems to indicate that $config{'db'} was assigned '' or undef. Are you sure both %config are the same variable?
In reply to Re^3: Can't use string ("") as a HASH ref while "strict refs"
by ikegami
in thread Can't use string ("") as a HASH ref while "strict refs"
by hesco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |