in reply to covariance calculation

To be in the safe side, Next time when you write something like that consider adding some extra checking in your sub for example

sub covariance { my ($arraylref, $array2ref) = @_; if ( ref($arraylref) ne 'ARRAY' or ref($array2ref) ne 'ARRAY') { return "expecting array reference to be passed"; } }