diff options
-rw-r--r-- | pod/perlrequick.pod | 5 | ||||
-rw-r--r-- | pod/perlretut.pod | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/pod/perlrequick.pod b/pod/perlrequick.pod index bb15c46e5c..7abd895e8a 100644 --- a/pod/perlrequick.pod +++ b/pod/perlrequick.pod @@ -380,8 +380,9 @@ C<$pattern> won't be changing, use the C<//o> modifier, to only 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, diff --git a/pod/perlretut.pod b/pod/perlretut.pod index be4693dd0f..b738c3b2cb 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<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 |