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

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

Thread Previous | Thread Next
Mike Guy
June 12, 2001 05:14
Re: [ID 20010612.001] out of memory during regex compilation
Message ID:
Robin Barker <> wrote
> You probably want to replace @@ by \@\@,
> as (I think) @@ will include array @.

No, actually.    "Punctuation" arrays aren't interpolated in doublequotish
strings.     A fact that doesn't seem to be documented.

In fact, how arrays interpolate isn't documented at all (except
implicitly in the description of $" in perlvar).

Patch below fixes this and other omissions, and also mends some overlong

Mike Guy

--- ./pod/perlop.pod.orig	Sun May  6 15:24:51 2001
+++ ./pod/perlop.pod	Tue Jun 12 13:10:01 2001
@@ -658,13 +658,15 @@
     Customary  Generic        Meaning	     Interpolates
 	''	 q{}	      Literal		  no
 	""	qq{}	      Literal		  yes
-	``	qx{}	      Command		  yes (unless '' is delimiter)
+	``	qx{}	      Command		  yes*
 		qw{}	     Word list		  no
-	//	 m{}	   Pattern match	  yes (unless '' is delimiter)
-		qr{}	      Pattern		  yes (unless '' is delimiter)
-		 s{}{}	    Substitution	  yes (unless '' is delimiter)
+	//	 m{}	   Pattern match	  yes*
+		qr{}	      Pattern		  yes*
+		 s{}{}	    Substitution	  yes*
 		tr{}{}	  Transliteration	  no (but see below)
+	* unless the delimiter is ''.
 Non-bracketing delimiters use the same character fore and aft, but the four
 sorts of brackets (round, angle, square, curly) will all nest, which means
@@ -733,6 +735,15 @@
 and although they often accept just C<"\012">, they seldom tolerate just
 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.
+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
 You cannot include a literal C<$> or C<@> within a C<\Q> sequence. 
 An unescaped C<$> or C<@> interpolates the corresponding variable, 

End of patch

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About