Hi Joe, So I had a chance to play with hashes further, and I noticed something that you might be interested in. It seems that 'bare' declaration of a hash with a "my" lexical scope enables you to stash away multiple 'hash' elements at the top level using a 'curly brace' syntax. However using the 'fat arrow' syntax will overwrite any previously stashed 'top level' hash elements.
Hopefully the REPL code below illustrates. First, 'curly brace' syntax: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > my @monsters = << godzilla grendel wormface blob fingfangfoom tingler >>; [godzilla grendel wormface blob fingfangfoom tingler] > my @rocks = << marble sandstone granite chert pumice limestone >> [marble sandstone granite chert pumice limestone] > my %stash {} > %stash{'monsters'} = @monsters [godzilla grendel wormface blob fingfangfoom tingler] > say %stash {monsters => [godzilla grendel wormface blob fingfangfoom tingler]} > %stash{'rocks'} = @rocks [marble sandstone granite chert pumice limestone] > say %stash {monsters => [godzilla grendel wormface blob fingfangfoom tingler], rocks => [marble sandstone granite chert pumice limestone]} > exit mbook:~ homedir$ [and now try 'fat arrow' syntax] mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > my @monsters = << godzilla grendel wormface blob fingfangfoom tingler >>; [godzilla grendel wormface blob fingfangfoom tingler] > my @rocks = << marble sandstone granite chert pumice limestone >> [marble sandstone granite chert pumice limestone] > my %stash {} > %stash = monsters => @monsters {monsters => [godzilla grendel wormface blob fingfangfoom tingler]} > %stash = rocks => @rocks {rocks => [marble sandstone granite chert pumice limestone]} > say %stash {rocks => [marble sandstone granite chert pumice limestone]} > say %stash<monsters> (Any) > exit mbook:~ homedir$ perl6 -v This is Rakudo version 2019.07.1 built on MoarVM version 2019.07.1 implementing Perl 6.d. HTH, Bill. On Thu, Mar 5, 2020 at 6:10 PM Joseph Brenner <doom...@gmail.com> wrote: > > William Michels <w...@caa.columbia.edu> wrote: > > > Yes, since I was working in the REPL, I tried compacting Joe's code by > > eliminating the "my %stash" line at the top, and adding "my" to the third > > line. > > I noticed the additional "my" in there, but I wouldn't have been able > to tell you why it was behaving like it was... > > On the plus side, I see that if you tried to do that in a script, it > would warn you: > > Potential difficulties: > Redeclaration of symbol '%stash'