Steny has asked for the wisdom of the Perl Monks concerning the following question:
What I use to do was do something like this:my $statement = "SELECT name, number, nw, land, strat, last_up +dated, ownerID FROM someTable ORDER BY numbe +r ASC"; $sth = $dbh->prepare($statement); + $sth->execute() or die "Can't execute the query: $sth->errstr" +; my $ref = $sth->fetchall_hashref('number'); for my $key( %$ref ) { $ref->{$key}->{nw} = addComma( $ref->{$key}->{nw} ); } my $countries = $sth->rows(); $sth->finish;
then simply send $rows to the Template. But because I have to modify the data, I don't know how to get it back into a format that the template will accept.my $rows = $dbh->selectall_arrayref(".....");
?my $ref = $sth->fetchall_hashref('number');
edit (broquaint): added <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sending hash to HTML::Template
by blokhead (Monsignor) on May 17, 2004 at 06:08 UTC |