in reply to Result set into array

Your question specified that you would like the results in an array, but the example output you provided is a hash, and you used selectall_hashref in your earlier reply.

If you would like to fetch all of the rows and have them in a hash then you need to specify which column should be used, as in this example:

my $hoh = $dbh->selectall_hashref($sql, $index_column);
In this example the structure would be as follows:
$hoh = { 1 => {id => 1, col2=>"abc", col3=>"def", col4=>"ghi"}, 2 => {id => 2, col2=>"lmn", col3=>"opq", col4=>"rst"}, }
Keep in mind that as it is returning a hashref the order of the rows will not be preserved. To preserve the order you would use selectall_arrayref as follows:
my $aoa = $dbh->selectall_arrayrefref($sql);
In this example the structure would be as follows:
$aoa = [ [1,"abc", "def", "ghi"], [2,"lmn", "opq", "rst"], ]
If you would like to preserve both the order and the column names, then you can use the Slice option for selectall_arrayref as follows:
my $aoh = $dbh->selectall_arrayref($sql, {Slice => {}});
In this example the structure would be as follows:
$aoh = [ {id => 1, col2=>"abc", col3=>"def", col4=>"ghi"}, {id => 2, col2=>"lmn", col3=>"opq", col4=>"rst"}, ]