in reply to Extra Space Issue
The values are coming back from your database that way, so either don't store them with the space to begin with or run the column in question through something like a TRIM(column) function in your select statement.
Having said that, that use of multiple ifs and 5 different variables looks bletcherous. Use a hash instead keyed on $type and it'd be much cleaner.
my %totals; # ... my( $type, $total ) = @{ $row }; $totals{ $type } += $total; #... my $grand_total += $totals{ $_ } for qw( A B C D W ); print "W: $totals{ 'W' }\n"; print "grand total: $grand_total\n";
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|