Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thats the code that keeps on going. I want it to stop when it reaches $ref2, but I cnat do it. Mine just keeps on looping, What should I dowhile (scalar(@names)) { print "?"; my $sql=$base_sql.($#names?'in ('.join(',',map('?',@names)).')':'=?' +); my $sth=$dbh->prepare($sql); my $rv=$sth->execute(@names); my ($res,$status) = $sth->fetchall_arrayref(); @names=map($res->[$_][0],0..$#$res); push @ref, join '|',@names if (scalar(@names)); }
while (scalar(@names)) { $b = @ref; if($b < 2) { print "?"; my $sql=$base_sql.($#names?'in ('.join(',',map('?',@names)).')':'=?' +); my $sth=$dbh->prepare($sql); my $rv=$sth->execute(@names); my ($res,$status) = $sth->fetchall_arrayref(); @names=map($res->[$_][0],0..$#$res); push @ref, join '|',@names if (scalar(@names)); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looper
by DamnDirtyApe (Curate) on Nov 24, 2002 at 03:27 UTC | |
by Anonymous Monk on Nov 24, 2002 at 03:32 UTC | |
|
Re: Looper
by Enlil (Parson) on Nov 24, 2002 at 03:30 UTC | |
by tadman (Prior) on Nov 24, 2002 at 04:21 UTC |