You can declare the keys as constants as you suggest, or use the
lock_keys function from
Hash::Util, which comes standard in recent perls. The latter will raise an exception at runtime if an non-existant key is set.
BTW, if you do use constants, an array is more efficient unless only a sparse set of keys are ever used at once:
use constant { K_AGE => 0, K_NAME => 1 };
my @record;
$record[K_AGE] = 1001;
$record[K_NAME] = 'Doraemon';
The difficulty in making hashes "strict" is just one of the reasons why many people dislike blessed-hashref object implementations.
Update: See also: non-autovivifing hash, how to avoid mis-spelling hash keys?.