in reply to Efficiency on Perl Code!

Make your various $sql definitions into an array.

Make an array the has $pointer will use.

Make an array of references to the arrays you'll push.

The you have (with lots of room for exercises for the user)
my $dbh = DBI->connect("DBI:ODBC:$db",$user,$pass,{RaiseError => 1}); my $sth; my @sql = .....; my @ptr = .....; my @arr = .....; for my $idx ( 0..$#sql ) { $sth = $dbh->prepare( $sql[$idx] ); $sth->execute() || die $sth->errstr; while ($pointer = $sth->fetchrow_hashref) { $value = $pointer->$ptr[$idx]; $value =~ s/\s+$//g; push $arr[$idx], $value; } }

One array of a structure would be better than several arrays, but yoiu get the idea.