I thought I would do this by assigning the array ref to a scalar on the first iteration. But instead of the first iteration, I end up with the last. (If there are ten rows that matched, $first contains the results from row 10... rather than row 1). How can a copy of the first array ref be saved for later use. Thanks.my $sth = $dbh->prepare("SELECT * FROM tickets ORDER BY ticket_id"); $sth->execute(); my $first; my $i = 0; while (my $record = $sth->fetch()) { if ($i == 0) { $first = $record; } blahh... blahh... $i++ }
In reply to Saving array reference by mhearse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |