The problem is that
use Env ... happens at compile-time, before you've stored anything in the
%hash hash. Another problem is your use of
qw() -- it literally sends the strings 'keys' and '%hash' to the Env module. But I think you're going about things the wrong way. Why not just place those values in the
%ENV hash directly?
BEGIN {
$ENV{APP_DIR} = "/usr/vendor/app/version";
# etc.
}
system("printenv"); # should have the new keys in it