develooper Front page | perl.perl6.language | Postings from April 2006

[svn:perl6-synopsis] r8899 - doc/trunk/design/syn

Thread Next
From:
autrijus
Date:
April 21, 2006 08:56
Subject:
[svn:perl6-synopsis] r8899 - doc/trunk/design/syn
Message ID:
20060421155623.7F2E1CB9BC@x12.develooper.com
Author: autrijus
Date: Fri Apr 21 08:56:22 2006
New Revision: 8899

Modified:
   doc/trunk/design/syn/S05.pod

Log:
* S05: Oops, turns out I entirely read perlop.pod incorrectly;
  "it matches once only" means "it matches successfully once only",
  not "it performs the match once only".  Sorry, TimToady++'s
  original example of:

    (state $x) ||= / pattern /; 

  was correct.

Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod	(original)
+++ doc/trunk/design/syn/S05.pod	Fri Apr 21 08:56:22 2006
@@ -1066,9 +1066,9 @@
 The Perl 5 C<?...?> syntax (I<match once>) was rarely used and can be
 now emulated more cleanly with a state variable:
 
-    (state $x) //= / pattern /;    # only matches first time
+    (state $x) ||= / pattern /;    # only matches first time
 
-To reset the pattern, simply say C<undefine $x>.
+To reset the pattern, simply say C<$x = 0>.
 
 =back
 

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About