develooper Front page | perl.perl6.users | Postings from December 2019

I need array of hashes help

Thread Next
From:
ToddAndMargo via perl6-users
Date:
December 3, 2019 10:40
Subject:
I need array of hashes help
Message ID:
acc67f11-13c3-21a2-f6e3-899ea0c62571@zoho.com
Hi All,

What am I doing wrong here?

$ p6 'my @y; my %x=(a=>"aa", b=>"bb"); @y[0] = %x; %x<a>="AA"; 
%x<b>="BB"; push @y,{%x}; for @y.kv -> $I, $J { say "Index $I  $J<a> 
$J<b>" }; say "elements " ~ @y.elems;'

Index 0  AA  BB
Index 1  AA  BB
elements 2


It should be

Index 0  aa  bb
Index 1  AA  BB
elements 2


Many thanks,
-T

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About