Hi William,

The line that has the important difference is where you put a `my` in
front of `%stash{'monsters'} = @monsters`. Probably a copy-paste error
or something like that.

>> my %stash> {}>> my @monsters = <<godzilla grendel wormface blob 
>> fingfangfoom>>
tingler>>> [godzilla grendel wormface blob fingfangfoom tingler]>> my
%stash{'monsters'} = @monsters;> {fingfangfoom => tingler, godzilla =>
grendel, wormface => blob}>> my @m = %stash{'monsters'};> [(Any)]>> say
@m> [(Any)]>> exit

timo@schmand ~> perl6 -e 'my %stash{"monsters"} = :1a; dd %stash'
Hash[Any,Str] %stash = (my Any %{Str} = :a(1))
timo@schmand ~> perl6 -e 'my %stash; %stash{"monsters"} = :1a; dd %stash'
Hash %stash = {:monsters(:a(1))}

Here you can see that in the case of having a "my" in front, the
assigned data doesn't get put in the hash at the "monsters" key.
instead, it gets assigned to the whole hash. The reason for that is that
`my %foo{Bar}` is syntax for restricting the keys of the hash to a
specific type (by default it's `Str(Any)`) and giving a string instance
("monsters" in this case) just takes the type of the value.

Hope that clears things up
  - Timo

Reply via email to