develooper Front page | perl.perl5.porters | Postings from August 2000

Re: [ID 20000804.003] heredoc in s///e replacement

Thread Previous | Thread Next
From:
Mike Guy
Date:
August 7, 2000 06:02
Subject:
Re: [ID 20000804.003] heredoc in s///e replacement
Message ID:
E13LmXh-0006rM-00@libra.cus.cam.ac.uk
iI wrote
> I agree with Ronald that I see no bug here.     But this area is clearly
> full of possibilities
>
> $ ./perl -wl
> $_ = 'test';
> s/t/<<E . 'fgh'
> dddd
> eeee
> E
> . 'ijk'/eg;
> print;
> __END__
> ^D
> Can't find string terminator "E" anywhere before EOF at - line 2.
> $

Having thought further about this case, and also contemplated the code
to see how one might go about "mending" it, I've come to the conclusion
that it's a feature rather than a bug and that a doc fix is appropriate.

Patch is for bleadperl.


Mike Guy

--- ./pod/perldata.pod.orig	Tue Aug  1 03:32:02 2000
+++ ./pod/perldata.pod	Mon Aug  7 13:54:41 2000
@@ -462,6 +462,22 @@
 	down from the door where it began.
     FINIS
 
+If you use a here-doc within a delimited construct, such as in C<s///eg>,
+the quoted material must come on the lines following the final delimiter.
+So instead of
+
+    s/this/<<E . 'that'
+    the other
+    E
+     . 'more '/eg;
+
+you have to write
+
+    s/this/<<E . 'that' 
+     . 'more '/eg; 
+    the other 
+    E 
+
 =head2 List value constructors
 
 List values are denoted by separating individual values by commas

End of patch

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