In this case it might interest you to learn that in Raku (Perl 6), the values passed to a function are also by default immutable within that function.
If one wants the function to mutate them, one has to explicitly mark them as `$x is rw` in the function signature; this then requires one to always pass a mutable container for $x. (A bit more detail: https://andrewshitov.com/2019/10/15/110-is-rw-vs-is-raw-in-r... )
That's a nice improvement, to be sure!