in reply to Re^3: Best Multidimensional Hash Practices?
in thread Best Multidimensional Hash Practices?
I never said it's the exists itself that autovivifies... sure it's the dereferencing. And the behaviour is all nice and dandy, if it does make sense to actually access the last element in the chain (and create intermediate structures as required), as is the case with your example where you're assigning a value. It just doesn't make much sense when there's no real need for complete dereferencing, such as when testing for existence or definedness.
In other words, why not take the shortcut and just not dereference the entire structure when it's clear right in the beginning that this isn't going to lead to any new conclusions with respect to the existence of the final key? I mean some special handling could be done for the sake of DWIM, just like it does happen elsewhere in Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Best Multidimensional Hash Practices?
by muba (Priest) on Oct 13, 2009 at 02:22 UTC |