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
use constant actually makes constant subroutines.
use constant
To do what you want, you need to explicitly call the sub:
use constant X => 1; my %x = ( &X => 'X');
or
use constant X => 1; my %x = ( X() => 'X');