From: Mark Kvale Date: Tue, 24 Feb 2004 11:32:34 +0000 (-0800) Subject: Bugfix for perlrequick and perlretut X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16e8b84077a7f90c46bd95640feeb546b4bfbf75;p=p5sagit%2Fp5-mst-13.2.git Bugfix for perlrequick and perlretut Message-Id: <200402241132.34656.kvale@phy.ucsf.edu> p4raw-id: //depot/perl@22368 --- diff --git a/pod/perlrequick.pod b/pod/perlrequick.pod index bb15c46..7abd895 100644 --- a/pod/perlrequick.pod +++ b/pod/perlrequick.pod @@ -380,8 +380,9 @@ C<$pattern> won't be changing, use the C modifier, to only perform variable substitutions once. If you don't want any substitutions at all, use the special delimiter C: - $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 allows the matching operator to match within a string as many times as possible. In scalar context, diff --git a/pod/perlretut.pod b/pod/perlretut.pod index be4693d..b738c3b 100644 --- a/pod/perlretut.pod +++ b/pod/perlretut.pod @@ -1325,9 +1325,9 @@ If you change C<$pattern> after the first substitution happens, perl will ignore it. If you don't want any substitutions at all, use the special delimiter C: - $pattern = 'Seuss'; + @pattern = ('Seuss'); while (<>) { - print if m'$pattern'; # matches '$pattern', not 'Seuss' + print if m'@pattern'; # matches literal '@pattern', not 'Seuss' } C acts like single quotes on a regexp; all other C delimiters