Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use string ("0") as a HASH ref

Tags:

hash

perl

I am trying this code and get an error when running it.

   $cfg->{'validRules'} = "true"
...


if ($cfg->{'validRules'} eq "true") { <== error is pointing to this
}

Error is

Error: Can't use string ("0") as a HASH ref while "strict refs" in use at

I am totally clueless. I tried changing it but still the same. Appreciate if I can get some help.

like image 578
Sreeram Ravinoothala Avatar asked Oct 23 '25 21:10

Sreeram Ravinoothala


1 Answers

You did something equivalent to

$cfg = 0;

at some point. This will obviously make

$cfg->{'validRules'}

fail. Find where you assign zero to $cfg and fix it.

like image 119
ikegami Avatar answered Oct 25 '25 14:10

ikegami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!