select sum(whatever)
from
-- 10 tables, omitted --
where
-- whole pile of stuff omitted --
group by
-- another pile of things
####
$sth->execute($foo, $bar, $rat) or die $sth->errstr, $/;
my $sum = $sth->fetchrow_arrayref->[0];
$sth->finish;
####
$sth->execute($foo, $bar, $rat) or die $sth->errstr, $/;
my $r = $sth->fetchrow_arrayref;
my $sum = $r ? $r->[0] : 0;
$sth->finish;
####
$sth->execute($foo, $bar, $rat) or die $sth->errstr, $/;
my $sum = ($sth->fetchrow_arrayref || [0])->[0];
$sth->finish;