Sql::Stash->set_sql('last_downloadevent', q(select max (ymdhms) from rktrack.downloadevent),'RKG',0); #### ... <% $last_downloadevent %> ... <%init> use Sql::Stash; my $stash = Sql::Stash->new; my $sth = $stash->sql_last_downloadevent; $sth->execute; my ($last_downloadevent) = $sth->fetch; $sth->finish; ... #### Sql::Stash->set_sql('last_downloadevent', q(select concat(max(ymdhms) ,'-', now()) from rktrack.downloadevent where ?>0),'RKG',0); #### select max(ymdhms) from rktrack.downloadevent #### perl -MSql::Stash -e "my $ss=Sql::Stash->new; my $sth=$ss->sql_last_downloadevent; $sth->execute; print $sth->fetch"