The argument type for keys by reference must be unblessed hashref or arrayref

if((scalar keys ($this->{'libraries'}->{$y}->{'cellHash'})) == 0){ 

This is the line in which I get "The argument type for the keys in the link must be unblessed hashref or arrayref". Can you help me fix this? I do not send the code for obvious reasons.

+4
source share
2 answers

Keys' new ability to take a link is broken by design. The Perl development team could not understand how it should work with some links, so it only works for some links. Therefore, keys ability to accept a link is documented as experimental . Failed to solve this problem, this "feature" was removed 5.24. You should not use it, as your code will stop working when updating perl .

You are in the case when keys does not work when providing a link. Instead, specify a hash or array. In this case, you probably want

 keys(%{ $this->{'libraries'}->{$y}->{'cellHash'} }) 

All this can be written as follows:

 if (!keys(%{ $this->{libraries}{$y}{cellHash} })) { ... } 
+8
source

% {$ this β†’ {'libraries'} β†’ {$ y} β†’ {'cellHash'}}. I missed the flower bracket and%.

0
source

Source: https://habr.com/ru/post/1485929/


All Articles