Skip to content

Commit

Permalink
perlsyn: Clarify loop localization
Browse files Browse the repository at this point in the history
Currently `foreach` and `for` loops are synonyms. Thus implicit
localization occurs not only for `foreach`. This change clarifies that
implicit localization occurs depending on style
  • Loading branch information
KES777 authored and khwilliamson committed Apr 16, 2022
1 parent 27bf08d commit 73bc018
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pod/perlsyn.pod
Expand Up @@ -527,8 +527,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. This implicit localization occurs I<only> in a C<foreach>
loop.
the loop. This implicit localization occurs I<only> for non C-style
loops.
X<my> X<local>

The C<foreach> keyword is actually a synonym for the C<for> keyword, so
Expand Down

0 comments on commit 73bc018

Please sign in to comment.