Skip to content

Commit

Permalink
[perl #113684] Document actual prec of loop exits
Browse files Browse the repository at this point in the history
These have always* had assignment precedence, such that

$a = goto $b = $c

is equivalent to

$a = (goto ($b = $c))

* I haven’t checked before perl 5.
  • Loading branch information
Father Chrysostomos committed Jul 27, 2012
1 parent e52de15 commit 2ba1f20
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pod/perlcheat.pod
Expand Up @@ -42,7 +42,7 @@ already be overwhelming.
|| // /m line based ^$ $ str end (bfr \n)
.. ... /s . includes \n + one or more
?: /x ignore wh.space * zero or more
= += -= *= etc /p preserve ? zero or one
= += last goto /p preserve ? zero or one
, => /a ASCII /aa safe {3,7} repeat in range
list ops /l locale /d dual | alternation
not /u Unicode [] character class
Expand Down
25 changes: 25 additions & 0 deletions pod/perlfunc.pod
Expand Up @@ -1620,6 +1620,11 @@ convert a core file into an executable. That's why you should now invoke
it as C<CORE::dump()>, if you don't want to be warned against a possible
typo.

Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
C<dump ("foo")."bar"> will cause "bar" to be part of the argument to
C<dump>.

Portability issues: L<perlport/dump>.

=item each HASH
Expand Down Expand Up @@ -2917,6 +2922,11 @@ NAME needn't be the name of a subroutine; it can be a scalar variable
containing a code reference or a block that evaluates to a code
reference.

Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
C<goto ("foo")."bar"> will cause "bar" to be part of the argument to
C<goto>.

=item grep BLOCK LIST
X<grep>

Expand Down Expand Up @@ -3237,6 +3247,11 @@ exit out of such a block.
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.

Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
C<last ("foo")."bar"> will cause "bar" to be part of the argument to
C<last>.

=item lc EXPR
X<lc> X<lowercase>

Expand Down Expand Up @@ -3754,6 +3769,11 @@ that executes once. Thus C<next> will exit such a block early.
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.

Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
C<next ("foo")."bar"> will cause "bar" to be part of the argument to
C<next>.

=item no MODULE VERSION LIST
X<no declarations>
X<unimporting>
Expand Down Expand Up @@ -5568,6 +5588,11 @@ turn it into a looping construct.
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.

Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
C<redo ("foo")."bar"> will cause "bar" to be part of the argument to
C<redo>.

=item ref EXPR
X<ref> X<reference>

Expand Down
2 changes: 1 addition & 1 deletion pod/perlop.pod
Expand Up @@ -48,7 +48,7 @@ values only, not array values.
left || //
nonassoc .. ...
right ?:
right = += -= *= etc.
right = += -= *= etc. goto last next redo dump
left , =>
nonassoc list operators (rightward)
right not
Expand Down

0 comments on commit 2ba1f20

Please sign in to comment.