Oh I was sure the syntax was ok in both forms. I'm guessing it's a GLR revision. It's indeed better to to reserve {} for scalar containers.
Notice how in Perl 6 you get a nice error message:
$ perl6 -e 'my %h = { foo => "bar" };'
Potential difficulties:
Useless use of hash composer on right side of hash assignment;
did you mean := instead?
at -e:1
------> my %h = { foo => "bar" }⏏;
Re:Perl 6 is fun
by justinator on Monday November 30, 2015 @08:20PM
(#10653089)
That's good, because in Perl 5, it does DWIM, but that sometimes means returning undef, which - erm, thanks Perl ;)
My personal way to solve this is to almost exclusively use references in complex data structures, so:
Is a hashref, that contains another hashref, which contains an array ref. Easy to bring up the 3rd thingy in the arrayref: This should be somewhat palatable to do actually, if you're slinging JSON all day.