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

? perlfunc.pod text wrongly removed ?

Thread Next
From:
karl williamson
Date:
April 25, 2010 08:53
Subject:
? perlfunc.pod text wrongly removed ?
Message ID:
4BD46556.9060004@khwilliamson.com
This commit to perlfunc.pod:

	author	brian d foy <bdfoy@cpan.org>	
	 Wed, 13 Jan 2010 20:29:54 +0000 (21:29 +0100)
	committer	brian d foy <bdfoy@cpan.org>	
	 Sat, 16 Jan 2010 14:41:32 +0000 (08:41 -0600)
	commit	8bdbc703cb0af3faf2163ebce618944c51f180a0

removed changes I had made for the new functionality of feature 
unicode_strings to the case changing functions (plus a mention of the 
tutorial on pack/unpack which I added, as I found it very helpful, and 
did not know of its existence).

Yesterday, I noticed my additions were missing, and so assumed that I 
had just forgotten to submit them, so I did so in the doc patch I 
submitted.  But then I decided to check it out, and found that they had 
been removed.

The reason I bring this up, is because that commit also removed other 
text that looks useful to me in quotemeta's description, so I wonder if 
that should be added back.  (It looks to me that somehow the text I had 
added had gotten moved around incorrectly before this commit was made, 
so just reverting doesn't seem like the best thing to do):

-quotemeta (and C<\Q> ... C<\E>) are useful when interpolating strings into
-regular expressions, because by default an interpolated variable will be
-considered a mini-regular expression. For example:
-
-    my $sentence = 'The quick brown fox jumped over the lazy dog';
-    my $substring = 'quick.*?fox';
-    $sentence =~ s{$substring}{big bad wolf};
-
-Will cause C<$sentence> to become C<'The big bad wolf jumped over...'>.
-
-On the other hand:
-
-    my $sentence = 'The quick brown fox jumped over the lazy dog';
-    my $substring = 'quick.*?fox';
-    $sentence =~ s{\Q$substring\E}{big bad wolf};
-
-Or:
-
-    my $sentence = 'The quick brown fox jumped over the lazy dog';
-    my $substring = 'quick.*?fox';
-    my $quoted_substring = quotemeta($substring);
-    $sentence =~ s{$quoted_substring}{big bad wolf};
-
-Will both leave the sentence as is. Normally, when accepting string 
input from
-the user, quotemeta() or C<\Q> must be used.
-

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