You're in need of some strictness.
What's going on in your last example is what's called a symbolic reference. $h is 'foo'. And so $h->{bar} resolves $h to 'foo', and looks up a hash named 'foo'. If you printed out "$foo{bar}", you'd get the same 1 as you're getting with "$$h{bar}".
And that confusion is why strict doesn't allow symbolic references. They were required at one time, but that was over twenty years ago, I think, so avoiding them is generally the right idea now, when there are other, better, ways to refer to other objects.