sub modify-copy-and-return(@a is copy, @b is copy) {
my @buffer;
@buffer.append: @a;
@buffer.append: @b;
@buffer.push: [1,2];
say "BEFORE RETURN ...";
dd @buffer;
# Array @buffer = [[1, 2], [3, 4], [3, 4], [5, 6], [1, 2]]
True, @buffer;
}
my @a = [1,2],[3,4];
my @b = [3,4],[5,6];
my $should-continue = False;
my @buffer;
($should-continue, @buffer) = modify-copy-and-return(@a, @b);
say "AFTER RETURN ...";
dd $should-continue;
dd @buffer;
:($should-continue, @buffer) := modify-copy-and-return(@a, @b);
say "AFTER RETURN ...";
dd $should-continue;
dd @buffer;