summaryrefslogtreecommitdiff
path: root/pod/perldiag.pod
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-06 13:36:57 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-06 13:36:57 +0000
commit36fb85f3330d45eeaf9d312c267fad71d5354c6c (patch)
tree65d9dfdc2758215a69fd42e5d1d5470e433d2278 /pod/perldiag.pod
parent3df15adcc3686bbc809ac9706048f258fd787941 (diff)
downloadperl-36fb85f3330d45eeaf9d312c267fad71d5354c6c.tar.gz
Mention state variables in perldiag. Add switch-related keywords
in the keyword listing section in perlfunc. Add a summary of C<state> in perlfunc. Fix a typo in the synopsis for C<our>. Don't say that C<my $_> is illegal in perlsub. p4raw-id: //depot/perl@28491
Diffstat (limited to 'pod/perldiag.pod')
-rw-r--r--pod/perldiag.pod7
1 files changed, 6 insertions, 1 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 93c8767ef3..8228cf9840 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1422,13 +1422,18 @@ conditional. Some people have exploited this bug to achieve a kind of
static variable. Since we intend to fix this bug, we don't want people
relying on this behavior. You can achieve a similar static effect by
declaring the variable in a separate block outside the function, eg
-
+
sub f { my $x if 0; return $x++ }
becomes
{ my $x; sub f { return $x++ } }
+Beginning with perl 5.9.4, you can also use C<state> variables to
+have lexicals that are initialized only once (see L<feature>):
+
+ sub f { state $x; return $x++ }
+
=item DESTROY created new reference to dead object '%s'
(F) A DESTROY() method created a new reference to the object which is