36
Your problem is that => is a magic comma that automatically quotes the word in front of it. So what you wrote is equivalent to ('X', 'X').
The simplest way is to just use a comma:
my %x = (X, 'X');
Or, you can add various punctuation so that you no longer have a simple word in front of the =>:
my %x = ( X() => 'X' );
my %x = ( &X => 'X' );
One way is to encapsulate X as (X):
my %x ( (X) => 1 );
Another option is to do away with '=>' and use ',' instead:
my %x ( X, 1 );