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

[perl #112522] Mildly incorrect wording in "perldoc perlre"

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
April 20, 2012 17:12
Subject:
[perl #112522] Mildly incorrect wording in "perldoc perlre"
Message ID:
rt-3.6.HEAD-4610-1334967168-765.112522-15-0@perl.org
On Wed Apr 18 14:08:56 2012, keithsthompson@gmail.com wrote:
> This is a bug report for perl from Keith.S.Thompson@gmail.com,
> generated with the help of perlbug 1.39 running under perl 5.14.2.
> 
> 
> -----------------------------------------------------------------
> I see this with Perl 5.14.2 under Ubuntu 12.04 beta2, and with
> v5.15.9-134-g8aed2c6 built from the git sources, branch "blead".
> 
> "perldoc perlre" says:
> 
> � � m � Treat string as multiple lines. �That is, change "^" and "$"
> � � � � from matching the start or end of the string to matching the
> � � � � start or end of any line anywhere within the string.
> 
> But "$" (without /m) doesn't just match the end of the string; it
> matches either the end of the string or just before a trailing
> newline.
> 
> I can't think of a non-clumsy way to word this.
> -----------------------------------------------------------------
> ---
> Flags:
> � � category=core
> � � severity=low
> ---
> Site configuration information for perl 5.14.2:
> 
> Configured by Debian Project at Fri Mar 23 17:28:34 UTC 2012.
> 
> Summary of my perl5 (revision 5 version 14 subversion 2)
> configuration:

Does this illustrate what you are speaking about?

##########

$ cat 112522.pl 
use strict; use warnings; use feature qw( :5.10 );

my $multiline = join("\n" => (
    'Alpha this is the first line beta',
    'Gamma this is the second line delta',
    'Epsilon this is the third line zeta',
) );

my @patterns = (
    qr/^Alpha/,     qr/^Gamma/, qr/^Epsilon/,
    qr/beta$/,      qr/delta$/, qr/zeta$/,
    qr/first/,      qr/second/, qr/third/,
);

for (my $i=0; $i<=$#patterns; $i++) {
    if ($multiline =~ m/$patterns[$i]/) {
        say "$i: Matched";
    }
    else {
        say "$i: Not matched";
    }
}

$ perl 112522.pl 
0: Matched
1: Not matched
2: Not matched
3: Not matched
4: Not matched
5: Matched
6: Matched
7: Matched
8: Matched

##########

Thank you very much.
Jim Keenan

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

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