$ perl -wMstrict use Hash::Util qw/lock_keys/; my $row = { foo=>3, bar=>7 }; lock_keys %$row; print "$$row{foo}\n"; print "$$row{bsr}\n"; __END__ 3 Attempt to access disallowed key 'bsr' in a restricted hash at - line 5.