The quotes are optional on barewords used as hash elements.
$hash{key} is the same as $hash{'key'}
$hash{shift} is the same as $hash{'shift'}
$hash{K} is the same as $hash{'K'}
Use
$hash{K()},
$hash{&K},
$hash{(K)} or
$hash{+K}
to work around the autoquoting.
Update: I thought I'd add a link to the relevant documentation, but I can't find documentation on this. perldata mentioned the auto-quoting property of =>, but not of the hash index.
In reply to Re: using constants
by ikegami
in thread using constants
by Hena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |