in reply to Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?

Could I have written it better, cleaner, or safer?

Better and cleaner, yes. Your $data is an array of arrays and you convert it to an array of hashes by hand. Far better to have DBI do that for you.

return $dbHandle->fetchall_arrayref ({});

BTW, I would rename that variable. $db is your DB handle. What you have called $dbHandle is a statement handle. Anyone else coming to this code would be confused by that.


🦛

  • Comment on Re: Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?
  • Download Code