in reply to Re^2: Should this happen?
in thread Should calling 'exists' create a hash key?
In the case of $a[100][42] = pi, obviously there is autovivification. That has no difference from $a->{"a"}{"a"} = pi.
Whether $a[100] makes $a[0] through $a[99] autovivified is not a black white thing, and I am not the first person who classifies that as autovivification. When it is valid to look at this from a perl internal point of view as you did, it is at least not less valid to look at this from a logical point of view. Look at this:
use strict; use warnings; my @as; $as[10] = 0; for my $a (@as) { print "."; }
this will print 11 dots, not 1 or 12.
To further pursuit a single correct answer to this question is not very useful, as autovivification is not a clearly defined concept, but rather a commonly used not-clearly-defined terminology that is often expressed through examples.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Should this happen?
by Fletch (Bishop) on Sep 20, 2005 at 13:57 UTC |