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

[perl #3636] heredoc in s///e replacement

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 18, 2012 23:32
Subject:
[perl #3636] heredoc in s///e replacement
Message ID:
rt-3.6.HEAD-11234-1345357936-1501.3636-15-0@perl.org
On Sun Aug 06 23:02:25 2000, RT_System wrote:
> 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
> 

Well that’s very interesting.  That was never applied, which I think is
fortunate, as Larry Wall specifically made nested here-docs *not* work
that way in commit fd2d09532.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org:443/rt3/Ticket/Display.html?id=3636

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