summaryrefslogtreecommitdiff
path: root/pod/perlsub.pod
diff options
context:
space:
mode:
authorRicardo SIGNES <rjbs@cpan.org>2007-11-14 10:34:30 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-15 07:59:40 +0000
commitf292fc7a7d8460bfc8c09d1cb38f8427574bdfaa (patch)
treeca3f39f5bbbcf4348e7cc7992aed76bd63f115ff /pod/perlsub.pod
parent0fe18d469d35fb885f2b7b708780d772e048c0c7 (diff)
downloadperl-f292fc7a7d8460bfc8c09d1cb38f8427574bdfaa.tar.gz
perlsub's docs on state assignment are busted
Message-ID: <20071114203430.GA7191@zodiac.codesimply.com> p4raw-id: //depot/perl@32325
Diffstat (limited to 'pod/perlsub.pod')
-rw-r--r--pod/perlsub.pod9
1 files changed, 4 insertions, 5 deletions
diff --git a/pod/perlsub.pod b/pod/perlsub.pod
index fed1474a03..72b28f1add 100644
--- a/pod/perlsub.pod
+++ b/pod/perlsub.pod
@@ -453,11 +453,10 @@ each time the gimme_another() function is called:
Also, since C<$x> is lexical, it can't be reached or modified by any Perl
code outside.
-Be aware that assignment to C<state> variables (as in C<state $x = 42>)
-are executed every time; to initialize (or re-initialize) an undefined
-state scalar, you can use, for example, the defined-or assignment :
-
- state $x //= initial_value();
+When combined with variable declaration, simple scalar assignment to C<state>
+variables (as in C<state $x = 42>) is executed only the first time. When such
+statements are evaluated subsequent times, the assignment is ignored. The
+behavior of this sort of assignment to non-scalar variables is undefined.
=head3 Persistent variables with closures