3 ms·
Yes, you auto create variables in a hash when you reference then, so autovivification is just a fancy word meaning automatically declaring and setting a null va
by mmaunder 13y ago
Yes, you auto create variables in a hash when you reference then, so autovivification is just a fancy word meaning automatically declaring and setting a null value. So $myvar->{speling} would create that in a hashref silently. Creates horrible hard to find bugs.
- duskwuff 13y agoProbably worth noting that there is a Perl module which fixes this wart! no autovivification; http://search.cpan.org/~vpit/autovivification/lib/autovivification.pm http://search.cpan.org/~vpit/autovivification/lib/autovivifi... One of the things that's always impressed me the most about Perl is the degree to which modules can play with the language. Modules can add control structures (Try::Tiny), introduce new metaprogramming syntax (Moose), add operator overloading (overload)... it's very flexible.
- einhverfr 13y ago> One of the things that's always impressed me the most about Perl is the degree to which modules can play with the language. That's exactly the point of the article, btw. > Modules can add control structures (Try::Tiny), introduce new metaprogramming syntax (Moose), add operator overloading (overload)... it's very flexible. Technically they add functions, and the language allows you to use imported functions as control structures. This isn't so much to correct you as to clarify it for less familiar readers.