in reply to parsing $sth-{NAMES}

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

Replies are listed 'Best First'.
Re: Re: parsing $sth-{NAMES}
by Anonymous Monk on Mar 26, 2001 at 20:38 UTC
    This is absolutely what I was looking for. Hats off to you!