in reply to Why won't it please be a number?

my creates a var, so my $data[2] =~ ... makes no sense. An array element isn't a variable that can be created that way, and matching against a new var is not gonna do much. Get rid of that my.
use strict; use warnings; use Text::CSV_XS qw( ); my $file = "checkdata.csv"; my $csv = Text::CSV_XS->new({ Binary => 1 }) or die("Cannot create CSV object: ". Text::CSV->error_diag()); open(my $fh, '<', $file) or die("Can't open file \"$file\": $!\n"); my $sum; while (my $row = $csv->getline($fh)) { next if $row->[3] eq 'Lunch'; ( my $amt = $row->[2] ) =~ s/^\s+//; printf("%5.2f\n", $amt); $sum += $amt; } $csv->eof or die("Error parsing file: ", $csv->error_diag()); printf("Total: %5.2f\n", $amt);