>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...


Reply via email to