I'm very new to Perl and I'm confused with exactly how its variable scope works. I'm trying to create an array of Hashes from the result of a MySQL query.
The following code works, as intended, without use strict
my %hash = ();
while (my %hash = %{$qhand->fetchrow_hashref()} ) {
push(@results, {%hash});
}
but when strict is enabled it produces the following error:
Can't use an undefined value as a HASH reference at [filename] line XX (the line of the while statement).
Could someone tell me what I'm doing wrong and what the corresponding rule in strict is that I'm flaunting?