[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] clear docs on exists wrt autovivification



diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index e5518af..2f9a85c 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -1735,8 +1735,7 @@ X<exists> X<autovivification>

 Given an expression that specifies a hash element or array element,
 returns true if the specified element in the hash or array has ever
-been initialized, even if the corresponding value is undefined.  The
-element is not autovivified if it doesn't exist.
+been initialized, even if the corresponding value is undefined.

     print "Exists\n"   if exists $hash{$key};
     print "Defined\n"  if defined $hash{$key};



I think this change makes sense, because the removed sentence confused
too many people. (People on perlmonks regularly ask «why does exists
$hash{a}{ab} autovivifiy? it says in the docs it doesn't») No access to
a hash key autovivifies it. Only one level up autovivification may
happen. exists() is no different here in any respect.

Cheers,
Moritz


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]