my $query = qq{ select "t1" as t, count(*) as c from table_one UNION ALL select "t2", count(*) from table_two }; # Gives # +----+---+ # | t | c | # +----+---+ # | t1 | 4 | # | t2 | 2 | # +----+---+ my $table_status = $dbh->selectall_arrayref($query, {Slice => {}} ); # $table_status = [ # { t => 't1', c => 4 }, # { t => 't2', c => 2 } # ];