Skip to content

Instantly share code, notes, and snippets.

@mcmillhj
Created December 23, 2021 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcmillhj/3ac9edc27423dfb71e4108da89274c7e to your computer and use it in GitHub Desktop.
Save mcmillhj/3ac9edc27423dfb71e4108da89274c7e to your computer and use it in GitHub Desktop.
Extra layer of nesting added after return
sub modify-copy-and-return(@a is copy, @b is copy) {
my @buffer;
@buffer.append: @a;
@buffer.append: @b;
@buffer.push: [1,2];
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);
dd $should-continue;
dd @buffer;
# Array @buffer = [[[1, 2], [3, 4], [3, 4], [5, 6], [1, 2]],]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment