in reply to Saving array reference

If you need to process all the rows, moot's code will work. If you only need to get the first row, then LIMIT (if available) and $row = $dbh->selctrow_arrayref() will work without a loop. If you need to grab the first row and then process the remaining rows, then grab the first row and then loop: my $first = $sth->fetch; while (my $non_first_row = $sth->fetch) { ... }.