Gossamer Forum
Home : General : Perl Programming :

long script with options for dba queries

Quote Reply
long script with options for dba queries
i found a dba script i'm cleaning up a bit and am wondering about structure and form. the script takes about 10 optional arguments to perform and print out certain queries in similar, but slightly different formats. right now the script is totally linear.....

if ($ARGV[0] eq "-indexes") {
$sql = massive_multiline_query;
print "custom_header";
print "data_from_query";
} elsif ($ARGV[0] eq "-tablespaces") {
$sql = another_massive_query;
print "another_header"
print "data_from_this_query";
} ....repeated 10 times

well, i can't figure out whether to make some big hash at the beginning of the script that contains all the opts, queries, headers, formats, and then just have a few lines of main code or to leave it as is...the linear makes the script long and awkward, but....the hash looks pretty ugly too. also, not sure what is actually most efficient....

anyway, just wondering if anyone has run into something like this and what if anything they decided to do.

thanks..