Also sprach fishfry:
I'm looking at a lot of code where they have
use constant FOO => "foo";
and then later
my $hash{+FOO} ...
Can someone please explain what '+' signifies in this context?
Barewords in hash subscripts are treated by perl as strings. By writing
'{+FOO}' the subscript no longer qualifies as bareword and the Perl
interpreter then knows it is referring to an identifier, the constant
FOO.
Other ways to resolve this would be:
$hash{FOO()}
$hash{&FOO}
This works because under the hood constants are inlineable functions
(that is: functions with an empty prototype created at compile-time).
By the way:
my $hash{+FOO} ...
is a syntax-error. You cannot declare hash-elements with 'my'.
Tassilo