use constant actually makes constant subroutines.
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');
use constant actually makes constant subroutines.
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');