develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #27028] /$/ not honouring /m in some cases

Thread Next
From:
Michael G Schwern via RT
Date:
July 14, 2005 03:52
Subject:
[perl #27028] /$/ not honouring /m in some cases
Message ID:
rt-3.0.11-27028-117344.12.8447963679398@perl.org
> [zefram@fysh.org - Mon Feb 23 15:11:06 2004]:
> 
> Test case #0:
> 	perl -e '$eol = qr/$/m; "foo\nbar\n" =~ /$eol/; print $-[0], "\n"'
> 
> Test case #1:
> 	perl -e '$eol = qr/$/m; "foo\nbar\n" =~ /$eol(?:)/; print $-[0],
>    "\n"'
> 
> I'm getting the answer 7 from case #0 and 3 from case #1.  The correct
> answer is 3.  (The /$/m pattern should match at the embedded newline
>    at
> position 3.)

bleadperl@25129 reports 3 for both cases.


> Test case #2:
> 	perl -e '$eol = qr/$/; "foo\nbar\n" =~ /$eol/m; print $-[0], "\n"'
> 
> #2 is the converse of #1; it outputs 3 where it should output 7.

bleadperl reports 7.

I believe this bug is fixed but I'd like to see a test added before
closing it.  The regex tests scare me.

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