Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^5: Non-existent hash and error "not a hash reference at ..."by Athanasius (Archbishop) |
on Aug 18, 2015 at 14:57 UTC ( [id://1139023]=note: print w/replies, xml ) | Need Help?? |
Hello stevieb, From the thread linked in ++choroba’s post below, it appears that when a hash key is used as a reference, and use strict is not in force, Perl applies “autovivification-on-steroids”: it autovifies a new hash or array variable with the name of the key:
Output:
...the %17 hash completely broke free from the hash's namespace, and was created globally? Yes, but that’s because 17 is a special variable name, reserved for true globals. As LanX notes here, variables with standard names are created in the current package, as shown in the example code above. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|