Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
S04: Fix pre-GLR-ism
isn't it wonderful how much simpler this passage becomes through the GLR?
  • Loading branch information
moritz committed Sep 19, 2015
1 parent 3bf2eb9 commit 3f0277c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions S04-control.pod
Expand Up @@ -8,8 +8,8 @@ Synopsis 4: Blocks and Statements

Created: 19 Aug 2004

Last Modified: 8 Aug 2015
Version: 139
Last Modified: 19 Sep 2015
Version: 140

This document summarizes Apocalypse 4, which covers the block and
statement syntax of Perl.
Expand Down Expand Up @@ -383,16 +383,8 @@ There is no longer a C<continue> block. Instead, use a C<NEXT> block within
the body of the loop. See below.

The value of a loop statement is the list of values from each iteration.
Each iteration's value is returned as a single "argument" object. See
L<S02> for a long definition of argument, but in short, it's either an
ordinary object or a parcel containing multiple values.

Normal flat list context ignores parcel boundaries and flattens the list.

Iterations that return C<()> (such as by calling C<next> with no extra
return arguments) return that C<()> as the next value, which will therefore
disappear when interpolated in flat context, but will interpolate an empty
C<List> into slice context.
Each iteration's value is returned as a single object, only C<Slip>s flatten
into the return list.

For finer-grained control of which iterations return values, use C<gather>
and C<take>.
Expand Down

0 comments on commit 3f0277c

Please sign in to comment.