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.
|
|---|