develooper Front page | perl.perl5.porters | Postings from October 2003

[PATCH] perlop.pod Part 2 Corrections

From:
Shlomi Fish
Date:
October 11, 2003 03:03
Subject:
[PATCH] perlop.pod Part 2 Corrections
Message ID:
Pine.LNX.4.56.0310111200390.30661@vipe.technion.ac.il
Index: pod/perlop.pod
===================================================================
--- pod/perlop.pod	(revision 8)
+++ pod/perlop.pod	(working copy)
@@ -891,15 +891,28 @@
 
 =item /PATTERN/cgimosx
 
-Searches a string for a pattern match, and in scalar context returns
-true if it succeeds, false if it fails.  If no string is specified
-via the C<=~> or C<!~> operator, the $_ string is searched.  (The
-string specified with C<=~> need not be an lvalue--it may be the
-result of an expression evaluation, but remember the C<=~> binds
-rather tightly.)  See also L<perlre>.  See L<perllocale> for
-discussion of additional considerations that apply when C<use locale>
-is in effect.
+This operator determines if a string matches a regular expression 
+pattern. A pattern match like that can determine if a string
+contains a substring, or a more complex pattern. For example, if
+we wish to determine if a string contains the character C<a> followed
+by any number (including zero) of the character C<b> followed by
+C<c> we can use:
 
+    $string =~ /ab*c/
+
+We can construct even more complex patterns, and the mechanisms
+for doing so are detailed in L<perlre> and L<perlretut>.
+
+In scalar context this returns true if it succeeds, false if it 
+fails. 
+
+If no string is specified via the C<=~> or C<!~> operator, the $_ 
+string is searched.  (The string specified with C<=~> need not be 
+an lvalue--it may be the result of an expression evaluation, but 
+remember the C<=~> binds rather tightly.)  See also L<perlre>.  
+See L<perllocale> for discussion of additional considerations 
+that apply when C<use locale> is in effect.
+
 Options are:
 
     c	Do not reset search position on a failed match when /g is in effect.
@@ -1304,6 +1317,7 @@
 
 Examples:
 
+    # \b is a word boundary and so this matches the word "green"
     s/\bgreen\b/mauve/g;		# don't change wintergreen
 
     $path =~ s|/usr/bin|/usr/local/bin|;
@@ -1369,11 +1383,13 @@
 =item y/SEARCHLIST/REPLACEMENTLIST/cds
 
 Transliterates all occurrences of the characters found in the search list
-with the corresponding character in the replacement list.  It returns
-the number of characters replaced or deleted.  If no string is
-specified via the =~ or !~ operator, the $_ string is transliterated.  (The
-string specified with =~ must be a scalar variable, an array element, a
-hash element, or an assignment to one of those, i.e., an lvalue.)
+with the corresponding character in the replacement list.  This means
+replacing each character in SEARCHLIST with the corresponding one in 
+REPLACEMENTLIST. It returns the number of characters replaced or deleted.  
+If no string is specified via the =~ or !~ operator, the $_ string is 
+transliterated.  (The string specified with =~ must be a scalar 
+variable, an array element, a hash element, or an assignment to one 
+of those, i.e., an lvalue.)
 
 A character range may be specified with a hyphen, so C<tr/A-J/0-9/> 
 does the same replacement as C<tr/ACEGIBDFHJ/0246813579/>.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About