diff options
author | Martien Verbruggen <mgjv@comdyn.com.au> | 2003-01-01 03:42:28 +1100 |
---|---|---|
committer | hv <hv@crypt.org> | 2003-01-21 01:56:31 +0000 |
commit | 5c502d376a49ad340448e0e2cf8122d9ef9a6bcf (patch) | |
tree | 257b2008f64c1512c090db4ffce95f6d6f1fef0d /pod | |
parent | de37762f3a9822aa6b4b8e833f672685d8ce22a5 (diff) | |
download | perl-5c502d376a49ad340448e0e2cf8122d9ef9a6bcf.tar.gz |
Re: [perl #19236] perlsyn: implicit localisation in while()
Message-Id: <slrnb12bi4.4tt.mgjv@martien.heliotrope.home>
p4raw-id: //depot/perl@18532
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlsyn.pod | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index c27933015c..0d81b241c1 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -183,8 +183,6 @@ refers to the innermost enclosing loop. This may include dynamically looking back your call-stack at run time to find the LABEL. Such desperate behavior triggers a warning if you use the C<use warnings> pragma or the B<-w> flag. -Unlike a C<foreach> statement, a C<while> statement never implicitly -localises any variables. If there is a C<continue> BLOCK, it is always executed just before the conditional is about to be evaluated again, just like the third part of a @@ -319,7 +317,8 @@ is therefore visible only within the loop. Otherwise, the variable is implicitly local to the loop and regains its former value upon exiting the loop. If the variable was previously declared with C<my>, it uses that variable instead of the global one, but it's still localized to -the loop. +the loop. This implicit localisation occurs I<only> in a C<foreach> +loop. The C<foreach> keyword is actually a synonym for the C<for> keyword, so you can use C<foreach> for readability or C<for> for brevity. (Or because |