in reply to designing a program - your wisdom needed

If all that's different between your three "workhorse" programs is the SQL, why not read/run the SQL in the main program?

$dbh->do(<<SQL); -- create first temp table SQL $dbh->do(<<SQL); -- create second temp table SQL $dbh->do(<<SQL); -- create third temp table SQL

... or read the SQL from three files and run that SQL:

for my $file ("first.sql", "second.sql", "third.sql") { open my $fh, '<', $file or die "$file: $!"; local $/; my $sql = <$fh>; $dbh->do( $sql ); }

... or, if you prefer a canned solution, take a look at DBIx::RunSQL, which runs SQL from strings or files, and has some (rough) logic to execute multiple SQL statements from a single file.