in reply to Perl variable names stored in mysql fields

$config{'pagename'} is printed exactly as that without interpretation...

You might need an eval ... but it's hard to tell without knowing the context in which the snippet is being processed (which HTML templating system? (if any), etc.)