in reply to Reference found where even-sized list expected

What is returned from correlation (or the last statement in correlation, if you don't specifically return a value?

From the error given, I'm going to assume it's a reference of some form ... however, when declaring a hash in the way that you have, you need to specify a list of pairs (ie, an even sized list), rather than a reference.

Just for debugging, you might want to examine what's being returned from correlation:

my @return = correlation(\@primarys_array, \@secondarys_array); use Data::Dumper; warn Dumper \@return;

As you've named the variable 'hashref_return_A', I'm going to assume the return is a hashref, and not a hash. In which case, you'll want to use one of the following:

# note -- it's a scalar ($) not a hash (%) my $hashref_return_A = correlation(\@primarys_array, \@secondarys_arr +ay); # or # %{ ... } casts a hashref to a list my (%hashref_return_A) = %{ correlation(\@primarys_array, \@secondarys +_array) };