You can use foreach (0..$#rows)
Ilya
-----Original Message-----
From: Philip Mak
To: Michael A Mayo
Cc: [EMAIL PROTECTED]
Sent: 06/26/2001 10:36 AM
Subject: Re: Shorthand for $dbh->prepare and $sth->execute?
On Tue, 26 Jun 2001, Michael A Mayo wrote:
> > Is this reasonably efficient for tables that have thousands of rows?
e.g.
> >
> > $rows = $dbh->selectall_hashref("SELECT ...");
> > for my $row (@{$rows}) {
> > do something with $row
> > }
>
> You may know this already, but the way you wrote this is particularly
> inefficent because it creates a temporary copy of all the data in an
array.
What's the efficient way of doing this? $sth->fetchrow_hashref?
-Philip Mak ([EMAIL PROTECTED])
- RE: Shorthand for $dbh->prepare and $sth->exec... Orlando Andico
- Re: Shorthand for $dbh->prepare and $sth->... Tommy Wareing
- Re: Shorthand for $dbh->prepare and $sth->... Michael A. Chase
- Re: Shorthand for $dbh->prepare and $sth->... Tim Bunce
- RE: Shorthand for $dbh->prepare and $sth->exec... Michael Peppler
- RE: Shorthand for $dbh->prepare and $sth->exec... Marcotullio, Angelo
- Re: RE: Shorthand for $dbh->prepare and $sth->... Ali Zaidi
- Re: Shorthand for $dbh->prepare and $sth->exec... Michael A Mayo
- Re: Shorthand for $dbh->prepare and $sth->exec... Philip Mak
- Re: Shorthand for $dbh->prepare and $sth->... Michael A Mayo
- RE: RE: Shorthand for $dbh->prepare and $sth->... Sterin, Ilya
- RE: RE: Shorthand for $dbh->prepare and $sth->... Sterin, Ilya
- RE: Shorthand for $dbh->prepare and $sth->exec... Sterin, Ilya
- RE: RE: Shorthand for $dbh->prepare and $sth->... Marcotullio, Angelo
- Re: Shorthand for $dbh->prepare and $sth->exec... Tim Bunce
- Re: Shorthand for $dbh->prepare and $sth->... Michael Peppler
