morgon has asked for the wisdom of the Perl Monks concerning the following question:


Sorry for being too lazy to read the documentation, I am sure I would find my answer here...

But I just spend 15 minutes (or more) on a bug where I wrote

if($hash{key}) {
where I should have written
if($hash{$key}) {
so my problem is the automatic stringification of hash-keys that prevents such a but to be discovered at compile-time.

Plenty of times this is exactly what I want, but sometimes (as here) it can conceal bugs - so is there a way to turn it off, so that accessing a hash-element via bareword would be a compiliation error?

I am sure there is...

Many thanks!