Browse files

* S04 - Change this example:

    if -e { say "exists" } { extra() }

  to this:

    if rand { say "exists" } { extra() }

  Because bare "-e" may be removed along with all $_-defaulting forms
  (to be replaced by .-e), but bare "rand" defaults to 1, and as such
  should probably be still there.


git-svn-id: file:///data/svn/pugs@23433 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ac121f9 commit f14653f888a5a7f056b7a6478214990854ff67e3 audreyt committed Jun 3, 2006
Showing with 8 additions and 8 deletions.
  1. +8 −8 doc/trunk/design/syn/S04.pod
View
16 doc/trunk/design/syn/S04.pod
@@ -12,9 +12,9 @@ Larry Wall <larry@wall.org>
Maintainer: Larry Wall <larry@wall.org>
Date: 19 Aug 2004
- Last Modified: 5 May 2006
+ Last Modified: 3 June 2006
Number: 4
- Version: 20
+ Version: 21
This document summarizes Apocalypse 4, which covers the block and
statement syntax of Perl.
@@ -638,18 +638,18 @@ postcircumfix is fine, though.) Any block with whitespace
in front of it will be taken as terminating the conditional, even if
the conditional expression could take another argument. Therefore
- if -e { say "exists" } { extra() }
- if -e -> $x { say "exists" } { extra() }
+ if rand { say "exists" } { extra() }
+ if rand -> $x { say "exists" } { extra() }
is always parsed as
- if (-e) { say "exists" }; { extra() }
- if (-e) -> $x { say "exists" }; { extra() }
+ if (rand) { say "exists" }; { extra() }
+ if (rand) -> $x { say "exists" }; { extra() }
rather than
- if (-e { say "exists" }) { extra() }
- if (-e (-> $x { say "exists" })) { extra() }
+ if (rand { say "exists" }) { extra() }
+ if (rand (-> $x { say "exists" })) { extra() }
Apart from that, it is illegal to use a bare closure where an
operator is expected. (Remove the whitespace if you wish it to be

0 comments on commit f14653f

Please sign in to comment.