After a bit of research, I found this construction:
my ($a, @b, $c);
:($a is copy, @b, $c) := \(42, <a b c>, 42);
$a = 1;
say [$a, @b, $c]; # OUTPUTS: [1 (a b c) 42]
While this is still technically binding, it works the way I wanted — I can reassign $a
afterwards.
Unfortunately, this only works without any declarators. If we write my :($a is copy, @b, $c) := \(42, <a b c>, 42);
, it throws a Cannot assign to a readonly variable or a value
exception when attempting to reassign $a
.