# $dbi handle is available my @non_empties = grep { # almost like jeffa's now $dbh->selectcol_arrayref("select count(*) from $_")->[0] } $dbh->tables;