Author: audreyt
Date: Sat Jun 3 05:49:52 2006
New Revision: 9435
Modified:
doc/trunk/design/syn/S04.pod
Log:
* 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.
Modified: doc/trunk/design/syn/S04.pod
==============================================================================
--- doc/trunk/design/syn/S04.pod (original)
+++ doc/trunk/design/syn/S04.pod Sat Jun 3 05:49:52 2006
@@ -12,9 +12,9 @@
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 @@
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