|Do you know where your variables are?|
Re^8: RFC: Tutorial: use strict; now what!?by Xiong (Hermit)
|on Feb 25, 2012 at 14:36 UTC||Need Help??|
Being an obedient student, I always use warnings as well as strict...
The plot thickens...
Sorry, tangent; neither strictures nor warnings are always appropriate. That's why they can be turned off -- in fact, they're off by default. Much power is hidden away by each. Usually you don't want, or need, to do such stuff. Sometimes you do.
Also, no tool can guarantee that your code is bug-free or even typo-free. Some tools help to protect against some common mistakes but in the end, it's up to you. The most important abilities required to write less-buggy programs are (obliquely to Wall's dicta) humility, intellectual honesty, clean and consistent style, flexible focus, and raw experience.
I would not recommend that you check every hash key for existence before each use. But if you want to do something like this, you can try Hash::Util or (if you tend to work with $hashrefs rather than actual %hashes) Data::Lock. Please note that these are not equivalent tools.
Please don't take away from any comment here, especially from any comment of mine, that you must always or must never do anything. Software should be judged (in this order) by: (1) how well it works for the user, (2) how well it serves the needs of those who incorporate it as a component of other projects, and (3) how well it can be maintained, extended, and upgraded in future. Not on the list: impressing CS profs and didactic engineers busy evading their own work while prescribing your style.
I'm not the guy you kill, I'm the guy you buy. —Michael Clayton