while ( my $thread = $sth->fetchrow_hashref() ){ push @msgs, [$thread->{id}, $thread->{name}, $thread->{date}, $thread->{subj}, $thread->{day_rate}, $thread->{msg}]; } #### while ( my $thread = $sth->fetchrow_hashref() ){ # I duplicate the data because DBI says that it may # choose to reuse the reference that it returns. push @msgs, { %$thread }; }