On 2020-05-06 William Michels via perl6-users <perl6-us...@perl.org>
wrote:
> Can anyone answer why--in a one-liner using the "-pe" flag--the s///
> and tr/// functions do not require a "." (dot) preceding the function
> call?

Because they're not function calls, but *mutating* operators. As the
documentation says
https://docs.raku.org/language/operators#s///_in-place_substitution
``s///`` is an "in-place substitution":

    s/// operates on the $_ topical variable, changing it in place

and ``tr///``
https://docs.raku.org/language/operators#tr///_in-place_transliteration
says the same:

    tr/// operates on the $_ topical variable and changes it in place

And as usual, ``-p`` prints the value of ``$_`` at the end of each
loop, so you get the modified value.

-- 
        Dakkar - <Mobilis in mobile>
        GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                     6FE2 40EA 9883 7519 3F88
                            key id = 0x75193F88

Reply via email to