in reply to HTML::Template problems

Without seeing the code in question that calls the sub (and taking on board other comments), my guess is context:
# this should work my @messages = selectMsgFromDb(); # or, if you want to use references my $messages = selectMsgFromDb(); # and amend last line of selectMsgFromDb sub to: return \@msgs;

(I'm assuming you forgot to finish the sub } here in the snippet shown :)

Also, Data::Dumper is your friend. Use it, and dump variables as you go to check you're getting what you expected.

.02

cLive ;-)