... ($type, $total) = @$row; $type =~ s/\s+$//; # Remove trailing whitespace if ($type eq "A"){$a = $total;} ...