More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-06 Thread William Michels via perl6-users
Hello, 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? Clearly adding a "." (dot) before either one results in an error (code below). Also, adding a ".=" (dot-equals) sign before the either the s/// or

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-06 Thread Gianni Ceccarelli
On 2020-05-06 William Michels via perl6-users 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

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-06 Thread Laurent Rosenfeld via perl6-users
The s/// substitution operator is not a method (and tr/// also not). They both modify their operands, so there is no need anyway for a '.=' syntax, since they do already what the '.=' syntax is aimed at. Cheers, Laurent.

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-06 Thread William Michels via perl6-users
Thank you Laurent! Are there any other "operators that modify their operands" in Raku/Perl6 that don't require an initializing "." (dot)? I checked the "subst" command and it requires an initial ".=" when used with the "-pe" one-liner flag: mbook:~ homedir$ perl6 -pe '.=subst(/love|like/, "admir

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-07 Thread Gianni Ceccarelli
On 2020-05-06 William Michels via perl6-users wrote: > Are there any other "operators that modify their operands" in > Raku/Perl6 that don't require an initializing "." (dot)? The dot is used to call a method on an object. > I checked the "subst" command and it requires an initial ".=" when > us

Re: More questions on the "-pe" one-liner flag: in conjunction with s/// and tr///

2020-05-07 Thread Laurent Rosenfeld via perl6-users
Hi William, I guess that you now have answers to your questions. I would suggest, however, that you take a look as Andrew Shitov's book *Raku One-Liners*, available on-line ( https://andrewshitov.com/wp-content/uploads/2020/01/Raku-One-Liners.pdf). There are (around page 12) some explanations on