Re: the new raku.org is really beautiful (and tought about spurt)
[email protected] (Marc Chantreux) Mon, 8 Sep 2025 11:29:47 +0200
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <aL6iC1ADFxc8hkUA@prometheus> |
hi William,
On Sun, Sep 07, 2025 at 07:26:21PM -0700, William Michels via perl6-users wrote:
> `~$ raku -e 'my $fh = "ImportantFile_bak".IO; #create filehandle \
> "ImportantFile".IO.slurp.subst(:global, "Hello ", "Hi ") andthen
> spurt($fh, $_, :createonly);' `
this is way behond the rewrite of the example. and my sadness about the
way spurt is usable but still an interesting feedback because
TIMTODY and but there is no way to really describe why we choose one
against the other.
* I'm also fan of what I call "method as pipe" syntax and I would like
to write them as multiline but AFAIR I had some issues with that.
to illustrate that: my shell scripts looks like
getent passwd |
cut -d: -f7 |
sed '
/zsh$/ !d
s//&-static/
' |
sort |
uniq -c > busybox_fs/etc/passwd
and as I hate "misplaced parentheses" (I don't fear parentheses
when they're in the right place to tell the right thing like in scheme)
and that's one of the reasons I felt immediately in love with perl
30 years ago.
so my raku of dream would allow me something like:
so my dream would be to write liz's example close to this:
"example.txt".IO.slurp
.&{ g:s/Hello/Hi/ }
.spurt: $filename
regards
Marc
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQrhynLytp14smlCwy+er2aYc+1WAUCaL6iBgAKCRC+er2aYc+1 WEIWAQCDtyiXpOMRf2irvWTPUimiAM8XNdInzf6SSdiAYwjlGAEAsFcC34kw124u GGregnsg/gyB8mxsUI+B8NAxX+DKkgY= =i1a2 -----END PGP SIGNATURE-----