ToddAndMargo via perl6-users <perl6-us...@perl.org> wrote: > I am a little late to this conversation, but `,=` > looks a lot like `push` to me.
Yes that was my first impression, if you read ahead a bit in the discussion you'll see it explained. In summary: the <operator>= shortcuts all work in a precisely parallel way, so @r ,= 'd'; is the same as: @r = @r , 'd'; And remember, back in perl-land the default behavior is to flatten, but in raku arrays don't flatten unless you do something to make it happen-- by default it's oriented toward building up complex structures like arrays of arrays. So with this construct, you end up with the array containing a circular reference to itself in the first location, which is highly unlikely to be something you want. Hashes, on the other hand, *don't* tend to flatten by default, so ,= does something useful with them. If you wanted to just add an element to the end, you could do one of these: @r.append('d'); @r = | @r, 'd'; @r.push('d'); The trouble with that last one though, is you may find it surprising if you're pushing more than a single element, this will get you an array inside an array: @r.push(@a); This on the other hand, behaves just like an @r.append(@a) would: @r.push(| @a);