I don't understand this part "foreach my $choice (qw(a b)){" , I am running this code and its giving me the double lines in the for loop, "for(my $ix= 0; $ix < 6; $ix++){ " it is printing 12 lines instead of 6.
I've updated my code for $ix to start at 1, not 0. You had 10 variables in your opening block – dbh (1 thru 5) and dbh_b (1 thru 5). This loop generated both sets.