On Wed, Nov 22, 2000 at 03:14:13PM +0800, lyf wrote:
> this is not work ! 
> what mean is "(0..$#{$dat})".

it means "from 0 to the highest index in @$dat"

> ?? 00-11-22 ???? 10:57:00 ????????
> >try this. I haven't tested it (but i think this will work).
> >
> >$dat = $sth -> fetchall_arrayref;
> >foreach $i ( 0..$#{ $dat } ) {
> >   foreach $j ( 0..$#{ $dat->[$i] } ) {
> >     print $dat->[$i][$j];
> >  }
> >}

bah. c coders, the lot of you.

 $dat = $sth->fetchall_arrayref;
 foreach $i (@$dat) {
   foreach $j (@$i) {
      print $j;
   }
 }

better yet:

 $dat = $sth->fetchall_arrayref;
 print @$_ foreach (@$dat);

or something. i'm guessing you didn't want to just print the entries,
so you'll probably want to put a map or a join in there somewhere too.


as i'm sure you're aware, embperl can do array traversal for you:

[- $dat = $sth->fetchall_arrayref -]
<table>
  <tr>
    <td>
      [+ $dat->[$row][$col] +]
    </td>
  </tr>
</table>

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to