in reply to Extra Space Issue

I'm not sure how to prevent the extra space from being returned, but this is one way to remove it after the fact:
... ($type, $total) = @$row; $type =~ s/\s+$//; # Remove trailing whitespace if ($type eq "A"){$a = $total;} ...