in reply to perl, mysql: "fetchrow_array failed: fetch() without execute()"

No, you don't need two statement or database handles. Do you know what the $ID is when the statement fails? You're iterating over @$clusters but grabbing $ID's from @units. Maybe $ID is undef? I'd use placeholders something like this (with maybe some extra error handling in case nothing is selected into @row...which would be easy, just remove the "1" from the code below):
my $sth = $dbh->prepare("select * from finalLevel3 where id=?"); foreach $item (@{$clusters}) { $ID = $units[$i][0]; unless (eval { @row = $dbh->selectrow_array($sth, undef, $ID); 1 }) { die "Error on ID [$ID]: $@"; } # convert the mysql result back to a string again $promoter_line = join "\t", @row; $promoter_line .= "\n"; $parser_hash{$item} .= $promoter_line; $i++; }