in reply to Using hashref values in constant declarations.

If I may say ... your best bet would simply be to say my $HASHREFCONST = { ..., and be done with it.

In other words, “it is up to you” to see to it that none of the values in this hashref are actually modified ... that all of the programmers who surround you and who follow in your footsteps understand what $UPPER_CASE_ONLY means.

In the Perl environment, “a hash(ref)” (like an array(ref) ...) is fundamentally a dynamic data-structure, and it always will be.   Thus, while it “makes sense” (IMHO ...) to apply this nomenclature to static values, it does not (and never will ...) make sense for data structures which, in the world-view of the Perl language, are fundamentally dynamic:   lists, arrays, and hashes.

  • Comment on Re: Using hashref values in constant declarations.