On 2020-05-05 William Michels via perl6-users <perl6-us...@perl.org> wrote: > mbook:~ homedir$ perl6 -ne 'put .chop' demo1.txt > this is a test > I love Unix > I like Linux too > mbook:~ homedir$ perl6 -pe '.chop' demo1.txt > this is a test, > I love Unix, > I like Linux too,
The ``.chop`` method does not mutate its argument, it only returns a chopped value. If you want to mutate, you need to say so:: raku -pe '.=chop' demo1.txt Notice that the ``.=`` operator is: * not specific to ``chop`` * not even specific to calling methods In the same way that ``$a += 1`` is the same as ``$a = $a + 1``, so ``$a .= chop`` is the same as ``$a = $a.chop``. So, if you wanted, you could do:: raku -pe '.=uc' # print upper-case -- Dakkar - <Mobilis in mobile> GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88