develooper Front page | perl.perl5.porters | Postings from September 2009

Re: [perl #68804] underscore regex delimiters

Thread Previous | Thread Next
From:
David Nicol
Date:
September 1, 2009 14:30
Subject:
Re: [perl #68804] underscore regex delimiters
Message ID:
934f64a20909011429p78840f4fo8c4568c45c9e9e55@mail.gmail.com
On Sun, Aug 30, 2009 at 7:42 AM, Rafael
Garcia-Suarez<rgarciasuarez@gmail.com> wrote:
> Thanks, applied to bleadperl.

this is more thorough, and the test more fun:

diff --git a/pod/perlop.pod b/pod/perlop.pod
index adf0718..31489e1 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -962,6 +962,9 @@ from the next line.  This allows you to write:
     s {foo}  # Replace foo
       {bar}  # with bar.

+You can use alphanumerics for quote delimiters too, in which case
+the whitespace is required.
+
 The following escape sequences are available in constructs that interpolate
 and in transliterations.
 X<\t> X<\n> X<\r> X<\f> X<\b> X<\a> X<\e> X<\x> X<\0> X<\c> X<\N>
diff --git a/t/op/subst.t b/t/op/subst.t
index 30af8a2..f1b16ee 100644
--- a/t/op/subst.t
+++ b/t/op/subst.t
@@ -263,8 +263,8 @@ eval 's{foo} # this is a comment, not a delimiter
        {bar};';
 ok( ! @?, 'parsing of split subst with comment' );

-$snum = eval '$_="exactly"; s sxsys;m 3(yactl)3;$1';
-is( $snum, 'yactl', 'alpha delimiters are allowed' );
+{ my $match = eval '$_= q laurel;y subcostalis;s paperclip;m elite;$&';
+is( $match, 'lit', 'alpha delimiters are allowed' ); }

 $_="baacbaa";
 $snum = tr/a/b/s;

Thread Previous | 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