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

Re: [perl #109798] '/e' regexp modifier is not recognized by re pragma

Thread Previous | Thread Next
From:
demerphq
Date:
February 6, 2012 02:50
Subject:
Re: [perl #109798] '/e' regexp modifier is not recognized by re pragma
Message ID:
CANgJU+U0FzhTp-Nf77qyp4nm2x3xOms42_5V8Q-yQbMvC0=iVw@mail.gmail.com
On 5 February 2012 22:33, Ronald J Kimball <rjk@tamias.net> wrote:
> On Sun, Feb 05, 2012 at 07:46:55PM +0100, demerphq wrote:
>> On 5 February 2012 19:27, Tom Christiansen <tchrist@perl.com> wrote:
>> > But why mention /ee distinct from /e?  It's not special.
>> > You can have /eee and /eeee if you want.  eeeeetc.
>>
>> Yes I know, but /ee and /eeee are synonyms. And /ee *is* distinct from
>> /e. See the docs for more details.
>
> /ee and /eeee are not synonyms.  /ee performs two evals; /eeee performs
> four.

I stand corrected, thanks for pointing that out, I definitely did not know that.

$ perl -wle'sub foobar{"zoo"}; sub zoo { "giraffe" }; $_=qq("foo");
$x=qq(. "bar"); s/("foo")/$1 . $x/; print'
"foo" . . "bar"
$ perl -wle'sub foobar{"zoo"}; sub zoo { "giraffe" }; $_=qq("foo");
$x=qq(. "bar"); s/("foo")/$1 . $x/e; print'
"foo". "bar"
$ perl -wle'sub foobar{"zoo"}; sub zoo { "giraffe" }; $_=qq("foo");
$x=qq(. "bar"); s/("foo")/$1 . $x/ee; print'
foobar
$ perl -wle'sub foobar{"zoo"}; sub zoo { "giraffe" }; $_=qq("foo");
$x=qq(. "bar"); s/("foo")/$1 . $x/eee; print'
zoo
$ perl -wle'sub foobar{"zoo"}; sub zoo { "giraffe" }; $_=qq("foo");
$x=qq(. "bar"); s/("foo")/$1 . $x/eeee; print'
giraffe

I do wonder if this is intentional or an interesting implementation side effect.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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