use v6;

my @x = { name => "Foo" }, { name => "Bar"}
say @x.gist;     # [{name => Foo} {name => Bar}]
say @x.^name;    # Array
say @x[0].^name; # Hash

my @y = { name => "Foo" }
say @y;           # [name => Foo]
say @y.^name;     # Array
say @y[0].^name;  # Pair

my @z = { name => "Foo" },;
say @z;           # [{name => Foo}]
say @z.^name;     # Array
say @z[0].^name;  #  Hash


In the first example, creating an array of 2 hashes work.
In the second example the listy assignment removes the hashy-ness of
the right hand side.
In the 3rd example adding a comma at the end solves the problem.

Is this how it is recommended to initiate an array with a single hash?
Is there an operator that forces the assignment to item-assignment?

Gabor

Reply via email to