>while ($ref = $sth->fetchrow_hashref) {
> foreach $key (keys %{$ref}) {
>print "$key------ $ref->{$key}, ";
> }
Equivalently, but neater, and more Perlish:
while ($ref = $sth -> fetchrow_hashref() )
{
print map{"$_ => $$ref{$_}. \n"} keys %$ref;
}
You can do the same thing for CGI.pm parameters:
print map{"$_ => " . $q -> param($_) . ". \n"} $q -> param();
In both cases, you may want extra code to check for undefined values...
- How to print a table field in DBI? David Jacobowitz
- Re: How to print a table field in DBI? Mike<mickalo>Blezien
- Ron Savage
