two three potential problems with your code:
- your query is using 1 = ?. Was that just a careless example or are you trying to put some column names as parameters?
- Are you sure that $1 and $2 are set to a meaningful value before you call the sub?
- Your sub is not returning anything. What's going to happen after the execute?
Apart from that, passing an array of parameters is a legitimate way of calling execute, as you can see in DBI docs and DBI Recipes.
Can you build a simple and short test case, with sample data, so we can see where and how your script fails?