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

[perl #131930] s [foo] \n [bar] confuses line numbers

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 20, 2017 01:40
Subject:
[perl #131930] s [foo] \n [bar] confuses line numbers
Message ID:
rt-4.0.24-4759-1503193223-1713.131930-15-0@perl.org
On Sat, 19 Aug 2017 14:40:25 -0700, abigail@abigail.be wrote:
> 
> This is a bug report for perl from abigail@abigail.be,
> generated with the help of perlbug 1.40 running under perl 5.26.0.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> Consider the following program:
> 
> #!/opt/perl/bin/perl
> 
> use 5.010;
> 
> say "This is line " . __LINE__;
> s [foo] [bar];
> 
> say "This is line " . __LINE__;
> 
> __END__
> 
> This prints, as expected:
> 
> This is line 5
> This is line 8
> 
> 
> Now watch what happens if we move the replacement part of s///
> to the blank line below it:
> 
> #!/opt/perl/bin/perl
> 
> use 5.010;
> 
> say "This is line " . __LINE__;
> s [foo]
>   [bar];
> say "This is line " . __LINE__;
> 
> __END__
> 
> Now it gets the second line number wrong:
> 
> This is line 5
> This is line 7

perl5.24.2 is fine, so it was introduced some time between 5.24.0 and 5.26.0.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=131930

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