I'm trying to check whether the given key exists in the hash.
The simple example:
use feature ':5.10';
my %a = (a => 1, b => 2);
say %a ~~ 'a' ? 'YES' : 'NO'; # says NO -- why?
say %a ~~ 'c' ? 'YES' : 'NO'; # says NO
say 'a' ~~ %a ? 'YES' : 'NO'; # says YES
say 'c' ~~ %a ? 'YES' : 'NO'; # says NO
There is a description of smart mathing operator:
http://search.cpan.org/~rgarcia/perl-5.10.0-RC1/pod/perlsyn.pod#Smart_matching_in_detail
"...The behaviour of a smart match depends on what type of thing its
arguments are. It is always commutative, i.e. |$a ~~ $b| behaves the
same as |$b ~~ $a|..."
Why is the result of %a ~~ 'a' differs from the result of 'a' ~~ %a ?