http://qs321.pair.com?node_id=352638

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

I wonder, how to prevent (control) hashes members?
Let say
my %hash; $hash{'name'} = "Doraemon"; $hash{'age'} = "1000"; #... some code # oh! my birthday, i'm getting older $hash{'ege'} = "1001"; # oops, i just add new key
How to avoid this (silly) mistake?
One way i can think of is to define the keys in constants,
$k_name = 'name'; $k_age = 'age'; $hash{$k_ege} = "Do"; # warning, gotcha!
so the compiler can catch the mistake, when use strict. Any more 'efficient' ideas?