If you're sure it's the foreach loop that's causing the slowdown, you could do something simple like:
my $n = 0; while ( $n < scalar @array ) { my $sql = "SELECT blah FROM blah WHERE blah = $array[$n++] }
I'd be a little suprised if it was the foreach that was slowing you down, unless you have a monster @array. I'd suggest using Benchmark to compare the while and foreach loops.
--Kester
In reply to Re: Changing foreach loop for a while loop
by kesterkester
in thread Changing foreach loop for a while loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |