in reply to When testing for certain hash positions as non-zero, why werent the test positions set to empty string?

I think some behavior in Perl hash usage has changed. It used to be that $hash{test_elem} would set that hash key to a value of '' (empty string).

That's new to me. Care to demonstrate that with an older perl, or provide a pointer to some documentation or so?

What does happen is autovivification if you access a second-level hash element when the first level does not exist, ie $hash{a}{b} initializes $hash{a} to an empty hash reference.

Perl 6 - links to (nearly) everything that is Perl 6.
  • Comment on Re: When testing for certain hash positions as non-zero, why werent the test positions set to empty string?
  • Select or Download Code