getData{ $sql = shift; my ($total_cols) = $dbh->selectrow_array($sql) or die($dbh->errstr); ...