Hi Todd,

the error you're getting comes from a closing quotation mark missing
after "Larry

You will also need to give perl6 some hint that you want the list of
pairs to actually become a hash.

To do that, I would recommend just putting a % in front of the ()

The working code looks like this:

perl6 -e 'my %Vendors=("acme" => %( "ContactName" => "Larry",
"AccountNo" => 1234 ) ); say %Vendors;'
{acme => {AccountNo => 1234, ContactName => Larry}}

Hope that helps!
  - Timo

On 11/01/2019 19:41, ToddAndMargo via perl6-users wrote:
> Hi All,
>
> How do I do a hash inside a hash?
>
> So far I have:
>
> $ p6 'my %Vendors=("acme" => ( "ContactName" => "Larry, "AccountNo" =>
> 1234 ) ); say %Vendors;'
> ===SORRY!=== Error while compiling -e
>
>
> I want to be able to have both a Contact Name and and AccountNo
> associated with each key in %Vendors.
>
>
> Many thanks,
> -T

Reply via email to