Is there any way to use a constant as a hash key?
For example:
use constant X => 1;
my %x = (X => \'X\');
The above code will cr
Another option is to not use the use constant pragma and flip to Readonly as per recommendations in the Perl Best Practices by Damian Conway.
I switched a while back after realizing that constant hash ref's are just a constant reference to the hash, but don't do anything about the data inside the hash.
The readonly syntax creates "normal looking" variables, but will actually enforce the constantness or readonlyness. You can use it just like you would any other variable as a key.
use Readonly;
Readonly my $CONSTANT => 'Some value';
$hash{$CONSTANT} = 1;