Greetings, I much prefer this syntax:
`~$ raku -e 'my $fh = "ImportantFile_bak".IO; #create filehandle \ "ImportantFile".IO.slurp.subst(:global, "Hello ", "Hi ") andthen spurt($fh, $_, :createonly);' ` It has a nice left-to-right feel and keeps you from clobbering an `ImportantFile`. ( Once you're sure of your code/filehandles, clobber-away by deleting `:createonly` ). HTH, Bill. PS If `Str` had a `spurt` method, wouldn't you be in constant fear of a sensitive string literal (e.g. a password) being accidentally written to disk? > On Sep 7, 2025, at 13:24, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > >> On 7 Sep 2025, at 20:31, Marc Chantreux <m...@unistra.fr> wrote: >>>> with "example.txt".IO.slurp { >>>> s/Hello/Hi/; >>>> .spurt: $filename; >>>> } >>> >>> Now *that* I find to be an interesting idea. The oneliner would then >>> become: >>> >>> "example.txt".IO.slurp.subst("Hello","Hi").spurt($filename) >>> >>> which has a nice left-to-right feel. >> >> Which would be indeed my syntax of choice. > > Now a PR: > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_rakudo_rakudo_pull_5949&d=DwIFAg&c=009klHSCxuh5AI1vNQzSO0KGjl4nbi2Q0M1QLJX9BeE&r=H_4IX2PNs5J8Am4L9k8XPDKLi8_PeuhJoKcQtnXHZ4c&m=CdwLh6ejqGtN5pVo5BxHnyw_NNX6Q3THBGda101VuhkyU9wfE4bILSaNb-FFWw5p&s=lZpE981EjWUqSAUkAnzmw13LGlTKBgHNSgXAtYL99zY&e=