in reply to nested variable resolution
Take a look at Math::Expr. It stores math expressions as a parse tree object. You can store such objects in files with Data::Dumper.
After Compline,Zaxo