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

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

Thread Previous | Thread Next
From:
Hugo
Date:
August 4, 2000 11:15
Subject:
Re: [ID 20000804.003] heredoc in s///e replacement
Message ID:
200008041721.SAA05637@crypt.compulink.co.uk
In <20000804093955.B476438@linguist.dartmouth.edu>, Ronald J Kimball writes:
:On Fri, Aug 04, 2000 at 01:37:12PM +0100, Hugo wrote:
:> Trawling through old messages, I found this aside in
:>   http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-01/msg01423.ht
:ml
:> 
:> The following code gives the same results with all perls I've checked
:> after 5.004 up to and including bleadperl (it fails to find the end of
:> the heredoc in 5.004 and earlier):
:> 
:> crypt% ./perl -wl
:> $_ = "test";
:> s/t/<<E/eg;
:>   "new"
:> E
:> print
:> __END__
:>   "new"
:> es  "new"
:> 
:> crypt% 
:
:What is the bug?

Gak, it's my head. I'm expecting the string to eval-and-replace to
be qq{  "new"\n}, to become qq{new} after eval: it seems wrong that
the string should be qq{<<E}, since in that case it seems like the
compiler should not know to attribute the heredoc to it. But I have
a nasty suspicion that the compiler not knowing that was a bug I
fixed myself a mere sprinkling of eons ago.

I've probably been getting too much sleep, or something.

Hugo

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