use strict; use warnings; use Hash::Util qw( lock_keys unlock_keys ); my %hash = ( 'name' => "Doraemon", 'age' => "1000" ); lock_keys( %hash ); # oh! my birthday, i'm getting older $hash{'ege'} = "1001"; # oops, just TRIED to add new key.