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

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

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
August 4, 2000 11:27
Subject:
Re: [ID 20000804.003] heredoc in s///e replacement
Message ID:
20000804142824.C477116@linguist.dartmouth.edu
On Fri, Aug 04, 2000 at 06:21:12PM +0100, Hugo wrote:
> In <20000804093955.B476438@linguist.dartmouth.edu>, Ronald J Kimball writes:
> :On Fri, Aug 04, 2000 at 01:37:12PM +0100, Hugo wrote:
> :> 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:

That's the result you would get if you added another /e.

Compare to this:

$E = <<E;
  "new"
E
$_ = "test";
s/t/$E/eg;
print;

$_="test";
s/t/$E/eeg;
print;

Ronald

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