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

[perl #114040] Multiline constructs in regexp blocks

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 17, 2012 14:34
Subject:
[perl #114040] Multiline constructs in regexp blocks
Message ID:
rt-3.6.HEAD-11172-1345239249-58.114040-14-0@perl.org
On Mon Jul 09 06:29:12 2012, davem wrote:
> On Sun, Jul 08, 2012 at 02:18:36PM -0700, Father Chrysostomos wrote:
> > These all fail to parse with bleadperl, but work in 5.16:
> [snip]
> > /(?{ <<END
> > END
> > })/;
> 
> Note that the bleadperl change just made literal (?{}) be handled
> similarly to how array and hash indexes have always been parsed in
> interpolating strings. So this fails, and always has:
> 
>     qq[$a{ do {
>     <<END
>     foo
>     END
>     }}];

This is actually a hard one.  This works, and always has:

s//<<END
  /e;
blah blah blah
END

I seem to remember writing code that relies on that, too.

These work, too:

s/${ <<END
}//;
blah blah blah
END

m/${ <<END
}/;
blah blah blah
END

"${ <<END
  }";
noet oteuhhnto e
END

For consistency with historical behaviour, we would have to make this work:

/(?{ <<END
   })/
oentuh oenuth
END

-- 

Father Chrysostomos


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