in reply to Re^4: Fastest way to test membership in a constant set
in thread Fastest way to test membership in a constant set

Yep. A limitation of that syntax is that, whilst the hash is a constant, it contents are not.

[14:26:14.28] c:\test>p1 use constant HASH=>{ a=>1, b=>2 };; print %{ +HASH };; a 1 b 2 HASH->{ c } = 3;; print %{ +HASH };; c 3 a 1 b 2 delete HASH->{ $_ } for keys %{ +HASH };; print %{ +HASH };;

That can be solved using the same Hash::Util::lock_hash() method I mentioned above.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."