What are the rules concerning implicit treatment of barewords as strings when Perl knows it's a hash key? If I didn't know better, I would have thought that the same rules as an identifier apply. But I've seen a leading - character used, such as in named parameters to functions. For example:
require v5.8;
use strict;
use warnings;
my %XX;
$XX{a}= 1;
$XX{-b}= 2;
$XX{+c}= 3; #bareword 'c' not allowed. Interpreted as + applied to f
+unction call c().
print (join (", ", keys (%XX)), "\n");
The
-b is taken implicitly as
'-b', but the same doesn't happen with
+c.
Is anything allowed before, among, after the letters besides this? I can't find anything in the perldocs.
—John