in reply to Combining variables to create a single virtual variable

I don’t know what you mean by a “virtual variable”, but why not just use hashes:

my %sql_count_A_Ref_vs_Comp; my %sth_Count_Ref_vs_Comp; for (qw( A B C D )) { $sth_Count_Ref_vs_Comp{$_} = $dbh_B->prepare($sql_count_A_Ref_vs_C +omp{$_}) or die "Cannot prepare: " . $dbh_B->errstr(); $sth_Count_Ref_vs_Comp{$_}->execute() or die "$sth_Count_Ref_vs_Co +mp{$_}->errstr\n"; }

Adjust as needed to accommodate $letter_tag as the hash key.

Hope that helps,

Athanasius <°(((><contra mundum