So, In Strawberry Perl, %ENV appears to be an ordinary hash (at least it isn't tied), but it also appears to resolve keys case insensitively. This makes sense given that environment variables are case insensitive in PowerShell (I am not sure of the exact relationship between Windows environment variables and case). So, I am wondering how %ENV can simultaneously be an ordinary hash, and have "implicit" keys that are not listed when you call they keys builtin on it. Is the %ENV hash magical without being tied?
use strict;
use warnings;
# Env appears to be an ordinary hash
# 'TEMP' is present in the list of environment variables
# but 'temp' is not
printf "$_\n" foreach keys %ENV;
print "\n";
# this gives us the value of $ENV:TEMP
# which makes sense.
printf "uppercase 'temp' maps to %s\n", $ENV{TEMP};
# even though temp is not present in the
# list of keys, the same value appears as for
# $ENV{TEMP}
# This seems to make sense given the behavior of powershell
# (I am not quite sure what the relationship is between
# Windows environment variables and case, but this seems reasonable.)
printf "lowercase 'temp' maps to %s\n", $ENV{temp};
# However, %ENV is not a tied hash.
printf "Tie status: %s\n", tied(%ENV) // "not a tied variable";