To really achieve what you want, you would need to give up in syntax a bit. For example, you could store a reference to the variable (instead of its value) into the hash, or a sub (in this case, a closure) which, when called, returns the actual value. You could make the accessing of the values a bit more fancy by using tie
on your hash; but your requirement sounds so odd that we have maybe a XY Problem
here - so maybe it would help if you would first explain why
you want to do this. Then it would be easier to find a nice solution.
Ronald Fischer <email@example.com>