diff options
author | Karl Williamson <khw@cpan.org> | 2020-11-07 11:11:09 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-11-13 07:07:01 -0700 |
commit | df39a12d64011dffe679c5a69efd99323cf54701 (patch) | |
tree | 6458174de01b7627fe6f13e2bd81865af46dd0dc /pod/perlop.pod | |
parent | cae6fd476d927587e8a4d6a822086cca63e99f43 (diff) | |
download | perl-df39a12d64011dffe679c5a69efd99323cf54701.tar.gz |
perlop: Enhance a tr/// example
This more clearly demonstrates that the /s option squeezes based on
the result rather than the source
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index ddaf430b8b..1387dd6978 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -2670,8 +2670,8 @@ If the C</s> modifier is specified, sequences of characters, all in a row, that were transliterated to the same character are squashed down to a single instance of that character. - my $a = "aaaba" - $a =~ tr/a/a/s # $a now is "aba" + my $a = "aaabbbca"; + $a =~ tr/ab/dd/s; # $a now is "dcd" If the C</d> modifier is used, the I<REPLACEMENTLIST> is always interpreted exactly as specified. Otherwise, if the I<REPLACEMENTLIST> is shorter |