You can also do:
my $sth = $dbh->prepare( 'select * from foo' ); $sth->execute; my $fieldnames = $sth->{NAME}; while ( my $row = $sth->fetch ) { for ( 0 .. ( scalar @{ $fieldnames } - 1 ) ) { print "$fieldnames->[ $_ ] is $row->[ $_ ]\n"; } }
Also interesting is the $sth->{TYPE} arrayref. But that's not what you asked :-)
Chris
M-x auto-bs-mode
In reply to Re: parsing $sth-{NAMES}
by lachoy
in thread parsing $sth-{NAMES}
by fmogavero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |