It is registered in constant under CAVEATS.
A common way is to use ()
:
my %h = (A => "1", B() => "2");
or switch to a "non-strict bold comma" (or a simple comma):
my %h = (A => "1", B ,=> "2");
Usage &
does not embed a constant, as you can check with B :: Deparse :
$ perl -MO=Deparse ~/1.pl
sub B () { 'b' }
use constant ('A', 'a');
use constant ('B', 'b');
my(%h) = ('A', '1', &B, '2');
print "\na, b";
foreach $_ (sort keys %h) {
print "\n" . $_ . '=' . $h{$_};
}
/home/choroba/1.pl syntax OK
source
share