|
|
sybperl-l Archive
Up Prev Next
From: "Raja Sambamurty" <rajags at hotmail dot com>
Subject: any way to get the # of columns returned
Date: Nov 3 1997 3:38PM
Hi,
Using sybperl, I very often do the following
@retarr = $dbfh->sql ("select * from table");
Now I can do a print $#retarr to find out the number of rows returned,
but what I need to know is the number of columns. The reason I need to
know this is to do a print stmt as in
print "$retarr[0][1]\n";
^^^^
to determine how far to go with the subscripts. Is there a better way of
doing this ? I guess I could always work around with a
foreach $i (0..$#retarr) {
my $j=0;
while ( defined $retarr[$i][$j] ) {
print "$retarr[$i][$j]";
$j++;
}
print "\n";
}
Raja
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
|