warn Dumper \@msgs; #### while ( my $thread = $sth->fetchrow_hashref() ){ my (@data) = $thread->{id}, $thread->{name}, $thread->{date}, $thread->{subj}, $thread->{day_rate}, $thread->{msg}; push @msgs, \@data; } return @msgs; # although i would likely return \@msgs ... #### sub selectMsgFromDb { my ($self, %params) = @_; $self->checkRequiredParams(%params); my $sth = $dbh->prepare( $cfg->{retrieve_from_sql}->{msg} ); $sth->execute; my $messages = $sth->fetchall_hashref({}); # warn Dumper $messages; # in case you don't believe me ;) return $messages; }