develooper Front page | perl.perl5.porters | Postings from August 2008

[PATCH] clear docs on exists wrt autovivification

From:
Moritz Lenz
Date:
August 26, 2008 11:23
Subject:
[PATCH] clear docs on exists wrt autovivification
Message ID:
20080826182315.23353.qmail@lists.develooper.com
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About