79707500

Date: 2025-07-19 18:57:06
Score: 1.5
Natty:
Report link

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.

Reasons:
  • Blacklisted phrase (1): :(
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: fingolfin