I have a list of two-element lists, like what you'd get for example by (1..5) Z (20..24)
, that I want to make into a hash (in this example, what you get by {1 => 20, 2 => 21, 3 => 22, 4 => 23, 5 =>24}
. I could do it "by hand", but that isn't too elegant, and I'm sure Raku has a idiomatic way of doing it. The inelegant alternative I come up with is:
my @a = (1..5) Z (20..24);
my %a;
for @a -> @x {
%a{@x[0]} = @x[1];