in reply to Combining variables to create a single virtual variable
Identifier names like $sql_count_A_Ref_vs_Comp_B might be indicative of a deeper design problem. But a solution to the immediate problem presented could be:
foreach my $sql ( $sql_count_A_Ref_vs_Comp, $sql_count_A_Ref_vs_Comp_B, $sql_count_A_ref_vs_Comp_C, $sql_count_A_Ref_vs_Comp_D ) { my $sth = $dbh_B->prepare( $sql ) or die "Cannot prepare: " . $dbh +_B->errstr(); $sth->execute() or die $sth->errstr; }
This lets $sql stand in as an alias for each of those sql_count_A_blah_blah_blah variables. Then you just loop over them, repeating the same process for each.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Combining variables to create a single virtual variable
by Freezer (Sexton) on Sep 21, 2012 at 09:15 UTC |