develooper Front page | perl.perl5.porters | Postings from February 2004

Bugfix for perlrequick and perlretut

Thread Next
From:
Mark Kvale
Date:
February 24, 2004 11:34
Subject:
Bugfix for perlrequick and perlretut
Message ID:
200402241132.34656.kvale@phy.ucsf.edu
These patches fix a longstanding bug in the C<m''> examples. The bug is that 
C<m'$pattern'> does not match C<'$pattern'>, as  C<$> is still interpreted as 
an end of line assertion. Thanks go to Papp Zoltan for bringing the bug to my 
attention.

	-Mark


--- perl-5.8.3/pod/perlrequick.pod	2003-05-05 09:53:18.000000000 -0700
+++ perlrequick.pod	2004-02-24 10:45:23.000000000 -0800
@@ -380,8 +380,9 @@
 perform variable substitutions once.  If you don't want any
 substitutions at all, use the special delimiter C<m''>:
 
-    $pattern = 'Seuss';
-    m'$pattern'; # matches '$pattern', not 'Seuss'
+    @pattern = ('Seuss');
+    m/@pattern/; # matches 'Seuss'
+    m'@pattern'; # matches the literal string '@pattern'
 
 The global modifier C<//g> allows the matching operator to match
 within a string as many times as possible.  In scalar context,


--- perl-5.8.3/pod/perlretut.pod	2003-10-05 21:39:40.000000000 -0700
+++ perlretut.pod	2004-02-24 10:50:19.000000000 -0800
@@ -1325,9 +1325,9 @@
 will ignore it.  If you don't want any substitutions at all, use the
 special delimiter C<m''>:
 
-    $pattern = 'Seuss';
+    @pattern = ('Seuss');
     while (<>) {
-        print if m'$pattern';  # matches '$pattern', not 'Seuss'
+        print if m'@pattern';  # matches literal '@pattern', not 'Seuss'
     }
 
 C<m''> acts like single quotes on a regexp; all other C<m> delimiters



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