Let's take it a bit at a time, working out from the centre.
exec_select ($sql ) calls a function called "exec_select" passing it $sql.
We assume that this function returns an array reference, deference that reference and get the first element from the dereferenced array (that's @{ exec_select ($sql ) } [0]).
We then assume that the first element in that array contains a hash reference. We look for the "home1" key in the referenced array (that's @{ exec_select ($sql ) } [0] ->{ home1 }).
It's at this last stage that it goes wrong. We're assuming that we have a hash reference - but Perl finds undef instead. You (obviously) can't use undef as a hash reference so Perl throws an error.
You need to look at the value that is returned by exec_select. It is an array reference as expected, but the contents of that array (or, more specifically, the contents of the first element in that array) aren't what your code expects them to be.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Understanding this line of Code
by davorg
in thread Understanding this line of Code
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |