Nicholas Clark asked:
> %hash3 = @kv_array
>
> Is perl6 going to spot that @kv_array has an even number of entries, all
> are scalars (no pairs), and so do this
>
> for @kv_array -> key, value {
> %hash3{$key} = $value;
> }
Yes. Just like in Perl 5.
> Or is it going to treat non-pairs like this:
>
> for @kv_array -> key {
> %hash3{$key} = undef; # Or some other suitable default
> }
No.
> And what happens if I write
>
> %hash4 = ("Something", "mixing", pairs => and, "scalars");
That's perfectly okay (except you forgot the quotes around the <and>
and you have an odd number of elements initializing the hash).
Assuming you meant to write:
%hash4 = ("Something", "mixing", pairs => "and", "scalars", "together");
then you get:
%hash4{"Something"} = "mixing";
%hash4{"pairs"} = "and";
%hash4{"scalars"} = "together";
Damian