Hi Folks,

I ran into this situation today, which seems counterintuitive:

 my @one = 1,2,3;
 my @two = 4,5,6;
 my @both = @one,@two;
 my @first = @both[0];
 say @one.raku;
 say @first.raku;

output:

        [1, 2, 3]
        [[1, 2, 3],]

I was expecting @first and @one to be the same.
I discovered that I could instead write either of these --

  my (@first) = @both[0];
  my @first := @both[0];

or I could change the @both assignment to be

        my @both := @one, @two;

..but I wonder if there's an idiomatic approach -- or
way of thinking about this -- that makes this flow more
intuitive.

thanks
Brian

Reply via email to