I have pieve of code that I am trying to assign the return value but I see the following error. Appreciate if someone can let me know why am I getting this error.
Error: Not a HASH reference at line
sub getid {
my ($a, $b) = @_;
my $id = 1 << $a + 1 << $b;
return $id;
}
my $tip;
$tip->{'tock'}->[0]->{'brick'} = getid(2, 3); <== This is where I am having issue.
That’s not the code you actually ran to get that error. In your actual code,
$tipor$tip->{'tock'}->[0]is defined but doesn’t hold a reference to a hash. Print them out to find out which.It might be useful to dump your data structure to figure out what it actually is.