[ macperl-Bugs-514061 ] bad regex match in sample code

[email protected] Wed, 06 Feb 2002 17:19:26 -0800
Newsgroups perl.macperl.porters
Message-ID <[email protected]>
Bugs item #514061, was opened at 2002-02-06 17:19
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=107940&aid=514061&group_id=7940

Category: Documentation
Group: Development Branch
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: bad regex match in sample code

Initial Comment:
Example code in perlfaq4.pod (under <<HERE 
documents), should insert newline when '--' is 
preceded by space[s], not otherwise. Example 
uses \s*, which matches 0 or more spaces, 
should be \s+ to match 1 or more spaces.:

($quote = <<'    FINIS') =~ s/^\s+//gm;
        ...we will have peace, when you and all your 
works have
        perished--and the works of your dark master 
to whom you
        would deliver us. You are a liar, Saruman, and 
a corrupter
        of men's hearts.  --Theoden in 
/usr/src/perl/taint.c
    FINIS

# I've added an additional print to show quote 
before substitution of  ' --'
    print $quote . "\n\n";

    $quote =~ s/\s*--/\n--/;
    
    print $quote;

produces this:
....we will have peace, when you and all your works 
have
perished--and the works of your dark master to 
whom you
would deliver us. You are a liar, Saruman, and a 
corrupter
of men's hearts.  --Theoden in /usr/src/perl/taint.c


....we will have peace, when you and all your works 
have
perished
--and the works of your dark master to whom you
would deliver us. You are a liar, Saruman, and a 
corrupter
of men's hearts.  --Theoden in /usr/src/perl/taint.c

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=107940&aid=514061&group_id=7940