will not alter lexical ('my') variables in the outer scope. To achieve this you have to use a package variable, so delare it using
.
However, using a file to set your variables can be dangerous, think carefully if you really need to do that. Why not put the keys/values into a file, read it in the normal way, and construct the hash yourself?