#! perl -slw use strict; use Hash::Util qw[ lock_hash ]; use constant FOO => { x => 0 }; lock_hash( %{ FOO() } ); ++ FOO->{x}; print FOO->{x}; __END__ C:\test>junk7 Modification of a read-only value attempted at C:\test\junk7.pl line 7.