in reply to Select Count(*) result

As stated before - perldoc DBI is your friend.

However - for a quick answer - do is great but as previously stated doesn't work with select. If you want to avoid the prepare, execute, fetchrow path you can do:
my ($count) = $dbh->selectrow_array($sql); # or if you substitute '$data[\d+]' with ? in your sql my ($count) = $dbh->selectrow_array($sql, {}, @data);


my @a=qw(random brilliant braindead); print $a[rand(@a)];