in reply to Efficiency on Code

fetchrow_hashref is the slowest of the fetch methods. If you have a large number of rows, you can improve efficiency by using fetchrow_arrayref, or, even better, by using bind_columns.
my $sth = $dbh->prepare( $sql ); $sth->execute; my ($pointer); my $rv = $sth->bind_columns(\$pointer); while ($sth->fetch) { # do something with $pointer }
If you have under a few thousand fetches, it's unlikely this would gain you much time, but for larger fetches, it's the fastest.