my $query = 'apple';
my $sql = qq{ SELECT COUNT(*)
FROM table1
WHERE name=?
UNION SELECT COUNT(*) FROM table2
WHERE name=?
};
my $sth->execute($sql, $query, $query)
my $rows = $sth->fetchall_arrayref();
#table1
apple
apple
orange
pear
#table2
pear
apple
orange
orange
####
$VAR1 = [ [ '2' ], [ '1' ] ];
####
#table1
apple
apple
orange
pear
#table2
pear
apple
orange
orange
apple
####
$VAR1 = [ [ '2' ] ];
####
$VAR1 = [ [ '2' ], [ '2' ] ];