in reply to My habitual errors

I have a few, but this one turns out to be a huge time waster. The habitual part is that for some reason this error is completely invisible to me until my eyes are bloodshot and I've banged my head on the keyboard several times.

my %hash = (abc => 1, def => 2); $key = 'abc'; $value = $hash{key}; # now try to use $value for something

Maybe confession wil help.

Replies are listed 'Best First'.
Re^2: My habitual errors
by Moron (Curate) on Apr 05, 2007 at 11:59 UTC
    Very nasty! I was typing it out in vi in disbelief with the idea of running it through perl -d, and only when just about to type the actual mistake could my brain focus enough to spot it. And I suppose even though use strict would force the corrective focus in this particular example, it wouldn't trap every case where that error could be made.

    -M

    Free your mind

Re^2: My habitual errors
by TGI (Parson) on Apr 07, 2007 at 01:07 UTC
    Try using lock_keys from Hash::Util. It's like strict refs for hash keys.


    TGI says moo