# Loop over a series of keys foreach $key (@keys) { # Use the key to do a database lookup $sth->execute($key); # Get the results of the lookup ie all the entries in # the row keyed by the key. $columns_ref = $sth->fetchrow_arrayref(); # Push this reference onto another array to build up # an array of the rows corresponding to each key push(@entries, $columns_ref); } #### foreach $key (@keys) { $sth->execute($key); $temp_columns_ref = $sth->fetchrow_arrayref(); @temp_columns = @$temp_columns_ref; $columns_ref = \@temp_columns; push(@entries, $columns_ref); }