develooper Front page | perl.perl5.porters | Postings from June 2001

Re: [ID 20010612.001] out of memory during regex compilation

Thread Previous
From:
Mike Guy
Date:
June 12, 2001 11:10
Subject:
Re: [ID 20010612.001] out of memory during regex compilation
Message ID:
E159scZ-0000r2-00@draco.cus.cam.ac.uk
Ronald J Kimball <rjk@linguist.Thayer.dartmouth.edu> wrote
> s/such/such as/;

Thanks.   Corrected in the patch below.

> However, a little earlier in the doc, around line 695, is the sentence:
>
>   For constructs that do interpolate, variables beginning with "C<$>"
>   or "C<@>" are interpolated, as are the following escape sequences.

I think this sentence is the cause of the disorganisation.   See below.

> And there's also this bit, just after your new text:
>
> >  You cannot include a literal C<$> or C<@> within a C<\Q> sequence. 
> >  An unescaped C<$> or C<@> interpolates the corresponding variable, 

I put my new bit where it is precisely so that followed it naturally.

> The section on interpolation may be a bit disorganized right now.

I certainly agree.   I was trying to make the minimal change to include
the new information.    Probably a mistake.

The cause of the trouble is the sentence you quoted above.   That
introduces two different things  -  interpolation of variables *and*
interpolation of escapes.    Then there are several paragraphs on
escapes.   Then several on interpolation of variables (including my new
stuff) which are a long way from the intro.    So I suggest the fix
of splitting that intro sentence.

Patch applies over my previous one.

Note also that I've corrected the "eleven" to (an implicit) "twelve".
Am I right that \N{name} *is* interpolated in tr///?    I'm not very
well up on "use charnames".


Mike Guy

--- ./pod/perlop.pod.orig	Tue Jun 12 13:10:01 2001
+++ ./pod/perlop.pod	Tue Jun 12 18:44:07 2001
@@ -694,9 +694,8 @@
     s {foo}  # Replace foo
       {bar}  # with bar.
 
-For constructs that do interpolate, variables beginning with "C<$>"
-or "C<@>" are interpolated, as are the following escape sequences.  Within
-a transliteration, the first eleven of these sequences may be used.
+The following escape sequences are available in constructs that interpolate
+and in transliterations.
 
     \t		tab             (HT, TAB)
     \n		newline         (NL)
@@ -711,6 +710,9 @@
     \c[		control char    (ESC)
     \N{name}	named char
 
+The following escape sequences are available in constructs that interpolate
+but not in transliterations.
+
     \l		lowercase next char
     \u		uppercase next char
     \L		lowercase till \E
@@ -736,13 +738,14 @@
 C<"\015">.  If you get in the habit of using C<"\n"> for networking,
 you may be burned some day.
 
-Subscripted variables such as C<$a[3]> or C<$href->{key}[0]> are also
-interpolated, as are array and hash slices.    But method calls
-such as C<$obj->meth> are not interpolated.
+For constructs that do interpolate, variables beginning with "C<$>"
+or "C<@>" are interpolated.  Subscripted variables such as C<$a[3]> or
+C<$href->{key}[0]> are also interpolated, as are array and hash slices.
+But method calls such as C<$obj->meth> are not.
 
 Interpolating an array or slice interpolates the elements in order,
 separated by the value of C<$">, so is equivalent to interpolating
-C<join $", @array>.    "Punctuation" arrays such C<@+> are not
+C<join $", @array>.    "Punctuation" arrays such as C<@+> are not
 interpolated.
 
 You cannot include a literal C<$> or C<@> within a C<\Q> sequence. 

End of patch

Thread Previous


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