|
Re: while() I have a simple question: msg#00346perl-beginners
On Thu, Jul 23, 2009 at 21:29, Steve Bertrand<steve@xxxxxxxxxx> wrote: > I just ran into an issue where I was loosing literally half of some > expected data, which for a theoretical accounting system, would make for > some interesting audit trails (I already shave a fraction for myself, > but 50% will be noticeable ;) > > Is my oversight as simple as knowing that the previous-to-patch while() > statement below is simply throwing the row into $_, and then push()ing > the *next* row into @uledger_entries? > > --- ISP/trunk/lib/ISP/Ledger.pm 2009-07-24 01:17:20 UTC (rev 643) > +++ ISP/trunk/lib/ISP/Ledger.pm 2009-07-24 01:21:45 UTC (rev 644) > @@ -235,8 +235,8 @@ > > Â Â Â Âmy @uledger_entries; > > - Â Â Â while ($sth->fetchrow_hashref) { > - Â Â Â Â Â Â Â push (@uledger_entries, $sth->fetchrow_hashref); > + Â Â Â while (my $entry_ref = $sth->fetchrow_hashref) { > + Â Â Â Â Â Â Â push (@uledger_entries, $entry_ref); > Â Â Â Â} > Â Â Â Âreturn \@uledger_entries; > > Steve > Yep, that would do it. And the new code should stop it. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |