my $ref = $sth->fetchall_arrayref(); $sth->finish(); return map { $_->[$name_col] => $_->[$val_col] } @$ref;