The problem is that the select statements are somewhat complex, and I'm trying to use the same array iteration for different SELECT statements.
An example:
my $dbfile = "/tmp/storagedb.sqlite";
my $db;
my $rep = ();
my $selectstring = shift;
# Subs
$db = DBI->connect("dbi:SQLite:$dbfile","","") or die "ERROR: $!";
$rep = $db->selectall_arrayref($selectstring);
if (@$rep) {
foreach my $i (@$rep) {
foreach my $j (@$i) {
print "$j | ";
}
print $/;
}
}
$db->disconnect;
I need to put headers before the data, but the $selectstring may have different columns. |