Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, monks
I am trying to build a hash, but I am getting the warning "Odd number of elements in anonymous hash", caused by a function that is supplied by a library:
my $hshref = { foo => func(), bar => "baz" };I can fix it by forcing scalar context, but without that, the hash ends up malformed. My question is: what does that function return, so as to create a malformed hash? How is that even possible?
(Data::Dumper::Dumper(func()) prints nil, unless I force it to scalar, where it prints "undef")
|
---|
Back to
Seekers of Perl Wisdom