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

[perl #116773] Documentation of $ in perlre

Thread Next
From:
James E Keenan via RT
Date:
February 16, 2013 23:48
Subject:
[perl #116773] Documentation of $ in perlre
Message ID:
rt-3.6.HEAD-27190-1361058523-1405.116773-15-0@perl.org
On Fri Feb 15 05:45:39 2013, rob.dixon@gmx.com wrote:
> 
> 
> This is a bug report for perl from rob.dixon@gmx.com,
> generated with the help of perlbug 1.39 running under perl 5.16.2.
> 
> 
> -----------------------------------------------------------------
> 
> I have been working with a regular expression that uses `$` with the
> `/m` modifier, and have relaised that I was misunderstanding how `$`
> works. The problem is the line
> 
>      $        Match the end of the line (or before newline at the end)
> 
> The way I read that is that `$` matches both before and after a
> newline, 

While I can see that there might be some fuzziness about the concept of
'line', I honestly can't see where you came by the idea that '$' would
match *after* a newline.

> whereas what this actually means is
> 
>     Match the end of the _string_ (or before a newline at the end of
> the
> _string_)
> 
> This makes no difference without the `/m` modifier, but with it I was
> expecting `$` to match twice for each line. After all that is what the
> documentation says!
> 
> A _line_ is something very specific, and it is fair to think of it as
> a thing that is terminated by a newline character. Because regular
> expressions allow for multi-line strings I feel this should be
> changed.
> 
> 

Could you provide some examples of lines (strings?) where you
experienced this confusion?

Thank you very much.
Jim Keenan

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

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