Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: My habitual errors

by hangon (Deacon)
on Apr 05, 2007 at 08:26 UTC ( [id://608435]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://608435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found