On 09/28/2017 09:43 PM, Brandon Allbery wrote:
On Fri, Sep 29, 2017 at 12:32 AM, ToddAndMargo <toddandma...@zoho.com <mailto: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

Thank you!


I will probably use the @ for a while until I get use to
it for readability.

Reply via email to