Change 19043 by [EMAIL PROTECTED] on 2003/03/21 20:43:55
Subject: [PATCH] perlsub.pod and perlsyn.pod: better organise scoping info for
modifiers
From: Martien Verbruggen <[EMAIL PROTECTED]>
Date: Sat, 15 Mar 2003 12:31:47 +1100
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/pod/perlsub.pod#51 edit
... //depot/perl/pod/perlsyn.pod#35 edit
Differences ...
==== //depot/perl/pod/perlsub.pod#51 (text) ====
Index: perl/pod/perlsub.pod
--- perl/pod/perlsub.pod#50~18704~ Fri Feb 14 22:17:06 2003
+++ perl/pod/perlsub.pod Fri Mar 21 12:43:55 2003
@@ -325,14 +325,8 @@
the scope of $answer extends from its declaration through the rest
of that conditional, including any C<elsif> and C<else> clauses,
-but not beyond it.
-
-B<NOTE:> The behaviour of a C<my> statement modified with a statement
-modifier conditional or loop construct (e.g. C<my $x if ...>) is
-B<undefined>. The value of the C<my> variable may be C<undef>, any
-previously assigned value, or possibly anything else. Don't rely on
-it. Future versions of perl might do something different from the
-version of perl you try it out on. Here be dragons.
+but not beyond it. See L<perlsyn/"Simple statements"> for information
+on the scope of variables in statements with modifiers.
The C<foreach> loop defaults to scoping its index variable dynamically
in the manner of C<local>. However, if the index variable is
==== //depot/perl/pod/perlsyn.pod#35 (text) ====
Index: perl/pod/perlsyn.pod
--- perl/pod/perlsyn.pod#34~18532~ Mon Jan 20 17:56:31 2003
+++ perl/pod/perlsyn.pod Fri Mar 21 12:43:55 2003
@@ -134,6 +134,13 @@
} while $x++ <= $z;
}
+B<NOTE:> The behaviour of a C<my> statement modified with a statement
+modifier conditional or loop construct (e.g. C<my $x if ...>) is
+B<undefined>. The value of the C<my> variable may be C<undef>, any
+previously assigned value, or possibly anything else. Don't rely on
+it. Future versions of perl might do something different from the
+version of perl you try it out on. Here be dragons.
+
=head2 Compound statements
In Perl, a sequence of statements that defines a scope is called a block.
End of Patch.