On Fri, Sep 29, 2017 at 12:32 AM, ToddAndMargo <toddandma...@zoho.com>
wrote:

> $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for
> @(%x<b>) {say $_};'
> {aaa => x, b => [y q r], c => z}
> y
> q
> r
>
> This seems too easy.  I have to have done something wrong.
> What did I miss?
>

Only that it's even easier than you think: the @ was unnecessary when
building it. Perl 6 handles this kind of thing much better than Perl 5. And
there are other ways to spell the destructuring as well.

    pyanfar Z$ 6 'my %x = [aaa => "x", b=>["y","q","r"], c=>"z"]; say %x;
for %x<b>[*] {say $_};'
    {aaa => x, b => [y q r], c => z}
    y
    q
    r


-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to