Hi,

I was wondering whether following code can be rewritten using map/grep
construct.


    class A {
       has $.a;
       has $.b;
   }


   my @array= (
   A.new(a=>'a', b=>'11'),
   A.new(a=>'a', b=>'22'),
   A.new(a=>'v', b=>'33'),
   A.new(a=>'w', b=>'44'),
   A.new(a=>'v', b=>'55')
   );



   my %hash;
   for @array -> $elem {
   %hash{$elem.a}{$elem.b} =$elem;
    }


    say %hash.perl;

Can it?


-- 
Pozdrawiam

Kamil Kułaga

Reply via email to