I may be missing something but you can get DBI to do all this work for you. Using
selectall_arrayref() with the 'Slice' option will return an array reference of hash references the same as your
return \@ticketsRecords:
### execute command
### get the data
my $data = $db->selectall_arrayref( $dbCommand, { Slice => {} } );
return $data;