From: Tom Christiansen Date: Mon, 9 May 2011 02:42:54 +0000 (-0400) Subject: "fix bug; also prefix ?? matches with m due to 5.14 deprecation" X-Git-Tag: accepted/trunk/20130322.191538~4325 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=499a640db217d9e13779fabe08a7736127153ff3;p=platform%2Fupstream%2Fperl.git "fix bug; also prefix ?? matches with m due to 5.14 deprecation" I also fixed a bug in the original. I'm always getting C vs C swapped in my brain, which is what had happened here. The old code didn't do what it said it did because it contrary to the comments didn't reset at each eof -- because it used the C form which is all of ARGV rather than bare C for the last file read, and thus each per-file component of ARGV. I am concerned about the two paragraphs previous to that, because they use eof() and I am not perfectly clear that they should. But I left them as is. Jesse asked for "a lot of eyes", so if folks could please look at this patch and see whether it looks ok, I'd appreciate it. I did test it under blead, both with and without the prefixed m on the m?? matches, which is how I discovered it was buggy with the C not C. --tom --- diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 33eb4ae..603dd15 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -337,17 +337,17 @@ which is Perl short-hand for the more explicitly written version: Note that if there were a C block on the above code, it would get executed only on lines discarded by the regex (since redo skips the continue block). A continue block is often used to reset line counters -or C one-time matches: +or C one-time matches: # inspired by :1,$g/fred/s//WILMA/ while (<>) { - ?(fred)? && s//WILMA $1 WILMA/; - ?(barney)? && s//BETTY $1 BETTY/; - ?(homer)? && s//MARGE $1 MARGE/; + m?(fred)? && s//WILMA $1 WILMA/; + m?(barney)? && s//BETTY $1 BETTY/; + m?(homer)? && s//MARGE $1 MARGE/; } continue { print "$ARGV $.: $_"; - close ARGV if eof(); # reset $. - reset if eof(); # reset ?pat? + close ARGV if eof; # reset $. + reset if eof; # reset ?pat? } If the word C is replaced by the word C, the sense of the