There seems to be some confusion here about what you are passing. @bind_values needs to be an array of values not an array of hashes or other structure and the Slice is how the returned data is handled. Me thinks that your code needs to be more like
my @param = <array of values to pass TO database>;
my $sql = <some SQL with placeholders = ? to take values>;
my $array_ref = $dbh->selectall_arrayref($sql,undef,@param);
If you need to run the query for multiple sets of parameters you are better off preparing the SQL and then fetching the data multiple times with each set of parameters.
my $dbh = <create database handle>;
my $sth = $dbh->prepare("select * from table where col1=? and col2=?")
+;
...
@param = ("test1a","test1b");
$array_ref = $sth->selectall_arrayref($sth,undef,@param);
...
@param = ("test2a","test2b);
$array_ref = $sth->selectall_arrayref($sth,undef,@param);
...
The use of statement handle in the selectall_arrayref is not something I've used yet but is in the DBI docs.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.