> sub my_sub
> {
> my $dbh = shift;
> my $query = "SELECT id, name FROM table";
> my $sth = $dbh->prepare_cached("$query")
> or die $log->notice($dbh->errstr);
> $sth->execute();
>
> $sth->bind_columns(undef, \$id, \$name);
> while( $sth->fetch() ) {
> my $data = {};
> $data->{id} = $id;
> $data->{name} = $name;
> push @LoH, $data;
> }
> return @LoH;
> }
TT's hash and list types are actually refs to hashes and lists.
So my_sub should return \@LoH, not @LoH.
BTW, you are missing a "my @LoH;" declaration. As written, your
code appears to accumulate every new query onto the end of @LoH.
Craig