What I do not see in your snippet-jungle is ... any bind-parameters actually being supplied. The call expects an arrayref, not a scalar.
The sequence should be:
- Prepare a statement which has placeholders, to obtain a statement handle.
- Execute that statement handle one or more times, passing an arrayref of the bind-parameter values as its only parameter, to obtain a result-set that you can then iterate. If there is only one parameter, the array contains only one entry but it’s still an array, and so on.
Your example is so “snippet-ed” that it’s hard to see where you are going wrong, but my guess is the argument for execute. Or that the wrong SQL statement is being executed?