Bootstrap FreeKB - Perl (Scripting) - Resolve "Reference found where even-sized list expected"
Perl (Scripting) - Resolve "Reference found where even-sized list expected"

Updated:   |  Perl (Scripting) articles

Let's say something like this is being returned by your Perl script.

Reference found where even-sized list expected at example.pl line 16.

 

This typically occurs when the script contains something like this.

my %hash = {};

 

In Perl, there are 3 different kinds of hashes.

  • A regular hash, which is defined by the % and ( ) characters, such as %hash = ( );
  • A reference hash, which is defined with the $ and { } characters, such as $hash = { };
  • A hash array, which is defined with the % and [ ] characters, such as %hash = [ ];

 

This can be resolved by correcting the script to define a regular hash.

my %hash = ();

 

Or define a reference hash.

my $hash = {};

 

Or define a hash array.

my %hash = [];

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d12b36 in the box below so that we can be sure you are a human.