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. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti sans virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> Le mer. 6 mai 2020 à 23:11, William Michels <wjm1@caa.columbia.edu> a écrit : > 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 the tr/// function results in an error (code below). > Additionally, I would like to know if this is a related-or-different > issue compared to the question I posted earlier this week. > > Any explanation or assistance appreciated, > > Thank you, Bill. > > mbook:~ homedir$ cat demo1.txt > this is a test, > I love Unix, > I like Linux too, > mbook:~ homedir$ > > mbook:~ homedir$ perl6 -pe 's/love|like/admire/; ' demo1.txt > this is a test, > I admire Unix, > I admire Linux too, > mbook:~ homedir$ perl6 -pe '.s/love|like/admire/; ' demo1.txt > ===SORRY!=== Error while compiling -e > Missing required term after infix > at -e:1 > ------> .s/love|like/admire/; > expecting any of: > prefix > term > mbook:~ homedir$ perl6 -pe '.=s/love|like/admire/; ' demo1.txt > ===SORRY!=== Error while compiling -e > Missing required term after infix > at -e:1 > ------> .=s/love|like/admire/; > expecting any of: > prefix > term > mbook:~ homedir$ > > mbook:~ homedir$ perl6 -pe 'tr/aeiou/12345/;' demo1.txt > th3s 3s 1 t2st, > I l4v2 Un3x, > I l3k2 L3n5x t44, > mbook:~ homedir$ perl6 -pe '.tr/aeiou/12345/;' demo1.txt > ===SORRY!=== Error while compiling -e > Missing required term after infix > at -e:1 > ------> .tr/aeiou/12345/; > expecting any of: > prefix > term > mbook:~ homedir$ perl6 -pe '.=tr/aeiou/12345/;' demo1.txt > ===SORRY!=== Error while compiling -e > Missing required term after infix > at -e:1 > ------> .=tr/aeiou/12345/; > expecting any of: > prefix > term > mbook:~ homedir$ >Thread Previous | Thread Next