use strict; my $db = "MyServer"; #my $user = MyServerStuff::odbc->{ $db } { user }; my $user = 'bob'; #my $pass = MyServerStuff::odbc->{ $db } { pass }; my $pass = 'bob'; my $dbh = DBI->connect("DBI:ODBC:$db",$user, $pass, {RaiseError => 1}); my @sql = ( [ "g_total", <prepare($sql[1]); } my %data; sub cleanup { my $ret = shift; $ret =~ s/\s+$//g; return $ret; } for my $sthk (keys %sth) { my $sth = $sth{$sthk}; eval { $sth->execute(); }; if ($@) { die $sth->errstr; } while (my $pointer = $sth->fetchrow_hashref) { my $data = cleanup($pointer->{'DATA'}); push(@{$data{$sthk}}, $data); } $sth->finish; }